Skip to contentSkip to conversation

New "docker" ready qemu config

RFC PATCH In review Francis Laniel 2 participants 4 messages Apr 14, 2022 – Apr 21, 2022

lore
Share & tools
lore
#0 lore raw

cover New "docker" ready qemu config

Hi.

First, I hope you are fine and the same for your relatives.

In this contribution, I added a new qemu config for x86_64.
This configuration is mainly based on qemu_x86_64_defconfig but it adds kernel CONFIG_ to be able to use docker.
It also adds package related to docker like DOCKER_CLI and CONTAINERD.

The CONFIG_ options added were checked with moby check-config script [1].

I was able to build and execute the image with start-qemu.sh:
Welcome to Buildroot
buildroot login: root

# docker run --rm hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:10d7d58d5ebd2a652f4d93fdd86da8f265f5318c6a73cc5b6a9798ff6d2b2e67
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

Sadly, the image has to a bit big (more than 300M) but I think it is fine since this image will only be used for virtualization.

If you say any way to improve this contribution, feel free to share it!

Francis Laniel (1):
qemu_x86_64_docker: add new qemu defconfig

 DEVELOPERS                             |   2 +
 board/qemu/x86_64_docker/linux.config  | 112 +++++++++++++++++++++++++
 board/qemu/x86_64_docker/post-build.sh |  11 +++
 board/qemu/x86_64_docker/readme.txt    |   7 ++
 configs/qemu_x86_64_docker_defconfig   |  49 +++++++++++
 5 files changed, 181 insertions(+)
 create mode 100644 board/qemu/x86_64_docker/linux.config
 create mode 100755 board/qemu/x86_64_docker/post-build.sh
 create mode 100644 board/qemu/x86_64_docker/readme.txt
 create mode 100644 configs/qemu_x86_64_docker_defconfig

Best regards and thank you in advance.
---
[1] https://github.com/moby/moby/blob/master/contrib/check-config.sh

Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

RFC PATCH 1/1 qemu_x86_64_docker: add new qemu defconfig

This defconfig permits building an image with a "docker" ready kernel and docker related software installed.

---
 DEVELOPERS                             |   2 +
 board/qemu/x86_64_docker/linux.config  | 112 +++++++++++++++++++++++++
 board/qemu/x86_64_docker/post-build.sh |  11 +++
 board/qemu/x86_64_docker/readme.txt    |   7 ++
 configs/qemu_x86_64_docker_defconfig   |  49 +++++++++++
 5 files changed, 181 insertions(+)
 create mode 100644 board/qemu/x86_64_docker/linux.config
 create mode 100755 board/qemu/x86_64_docker/post-build.sh
 create mode 100644 board/qemu/x86_64_docker/readme.txt
 create mode 100644 configs/qemu_x86_64_docker_defconfig
DEVELOPERS +2 -0
index ca9decb58f..8a6374977a 100644
@@ -969,6 +969,8 @@ F:	package/ipmitool/
 F:	package/odhcploc/
 
 N:	Francis Laniel <[email protected]>
+F:	board/qemu/x86_64_docker
+F:	configs/qemu_x86_64_docker_defconfig
 F:	package/pahole/
 F:	package/sysdig/
 F:	package/tbb/
board/qemu/x86_64_docker/linux.config new file +112 -0

112 lines not on this page · raw message

board/qemu/x86_64_docker/post-build.sh new file +11 -0
new file mode 100755
index 0000000000..bf83a002c2
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -u
+set -e
+
+# Add a console on tty1
+if [ -e ${TARGET_DIR}/etc/inittab ]; then
+    grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \
+	sed -i '/GENERIC_SERIAL/a\
+tty1::respawn:/sbin/getty -L  tty1 0 vt100 # QEMU graphical window' ${TARGET_DIR}/etc/inittab
+fi
board/qemu/x86_64_docker/readme.txt new file +7 -0
new file mode 100644
index 0000000000..a7bf2b4e32
@@ -0,0 +1,7 @@
+Run the emulation with:
+
+  qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext4,if=virtio,format=raw -append "rootwait root=/dev/vda console=tty1 console=ttyS0" -serial stdio -net nic,model=virtio -net user # qemu_x86_64_docker_defconfig
+
+Optionally add -smp N to emulate a SMP system with N CPUs.
+
+The login prompt will appear in the graphical window.
configs/qemu_x86_64_docker_defconfig new file +49 -0

49 lines not on this page · raw message

Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Francis Laniel
Quoted 9 lines · Francis Laniel

Hi.

First, I hope you are fine and the same for your relatives.

In this contribution, I added a new qemu config for x86_64.
This configuration is mainly based on qemu_x86_64_defconfig but it adds kernel CONFIG_ to be able to use docker.
It also adds package related to docker like DOCKER_CLI and CONTAINERD.

We don't like adding "demo" defconfigs that are basically another defconfig
with some packages enabled. It's true that there is some value to knowing which combination of packages can provide a certain super-feature, but the problem is that the basic config (in this case, qemu_x86_64) is not going to be useful for most people.

In this particular case, there isn't even that much "combination". Just
docker-engine and docker-cli.

The kernel config options do have value, but these should instead be set by
containerd (or docker-engine, or docker-proxy, as appropriate), using CONTAINERD_LINUX_CONFIG_FIXUPS.

Regards,
Arnout

Quoted 36 lines

The CONFIG_ options added were checked with moby check-config script [1].

I was able to build and execute the image with start-qemu.sh:
Welcome to Buildroot
buildroot login: root

# docker run --rm hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:10d7d58d5ebd2a652f4d93fdd86da8f265f5318c6a73cc5b6a9798ff6d2b2e67
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

Sadly, the image has to a bit big (more than 300M) but I think it is fine since this image will only be used for virtualization.

If you say any way to improve this contribution, feel free to share it!

Francis Laniel (1):
qemu_x86_64_docker: add new qemu defconfig

  DEVELOPERS                             |   2 +
  board/qemu/x86_64_docker/linux.config  | 112 +++++++++++++++++++++++++
  board/qemu/x86_64_docker/post-build.sh |  11 +++
  board/qemu/x86_64_docker/readme.txt    |   7 ++
  configs/qemu_x86_64_docker_defconfig   |  49 +++++++++++
  5 files changed, 181 insertions(+)

create mode 100644 board/qemu/x86_64_docker/linux.config create mode 100755 board/qemu/x86_64_docker/post-build.sh create mode 100644 board/qemu/x86_64_docker/readme.txt create mode 100644 configs/qemu_x86_64_docker_defconfig

Quoted 3 lines

Best regards and thank you in advance.
---
[1] https://github.com/moby/moby/blob/master/contrib/check-config.sh

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Hi.

Quoted 17 lines · Le mardi 19 avril 2022, 22:16:43 BST Arnout Vandecappelle a écrit :
Quoted 9 lines · Francis Laniel

Hi.

First, I hope you are fine and the same for your relatives.

In this contribution, I added a new qemu config for x86_64. This configuration is mainly based on qemu_x86_64_defconfig but it adds kernel CONFIG_ to be able to use docker.
It also adds package related to docker like DOCKER_CLI and CONTAINERD.

We don't like adding "demo" defconfigs that are basically another
defconfig with some packages enabled. It's true that there is some value to knowing which combination of packages can provide a certain super-feature, but the problem is that the basic config (in this case, qemu_x86_64) is not going to be useful for most people.

Quoted 6 lines

In this particular case, there isn't even that much "combination". Just
docker-engine and docker-cli.

The kernel config options do have value, but these should instead be set
by containerd (or docker-engine, or docker-proxy, as appropriate), using CONTAINERD_LINUX_CONFIG_FIXUPS.

Sorry, I did not check docker-engine.mk before writing this contribution. I was not aware of PACKAGE_NAME_LINUX_CONFIG_FIXUPS and will rework my sysdig 0.29.1 contribution to make use ot it!

Quoted 42 lines

Regards,
Arnout

Quoted 38 lines

The CONFIG_ options added were checked with moby check-config script [1].

I was able to build and execute the image with start-qemu.sh:
Welcome to Buildroot
buildroot login: root

# docker run --rm hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest:
sha256:10d7d58d5ebd2a652f4d93fdd86da8f265f5318c6a73cc5b6a9798ff6d2b2e67
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

Sadly, the image has to a bit big (more than 300M) but I think it is fine since this image will only be used for virtualization.

If you say any way to improve this contribution, feel free to share it!

Francis Laniel (1):
qemu_x86_64_docker: add new qemu defconfig

  DEVELOPERS                             |   2 +
  board/qemu/x86_64_docker/linux.config  | 112 +++++++++++++++++++++++++
  board/qemu/x86_64_docker/post-build.sh |  11 +++
  board/qemu/x86_64_docker/readme.txt    |   7 ++
  configs/qemu_x86_64_docker_defconfig   |  49 +++++++++++
  5 files changed, 181 insertions(+)

create mode 100644 board/qemu/x86_64_docker/linux.config create mode 100755 board/qemu/x86_64_docker/post-build.sh create mode 100644 board/qemu/x86_64_docker/readme.txt create mode 100644 configs/qemu_x86_64_docker_defconfig

Best regards and thank you in advance.
---
[1] https://github.com/moby/moby/blob/master/contrib/check-config.sh

Best regards.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot