Re: [PATCH 1/9] tests/docker: Add dockerfile for Alpine Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 12/20/20 9:53 PM, Jiaxun Yang wrote:
Alpine Linux[1] is a security-oriented, lightweight Linux distribution
based on musl libc and busybox.

It it popular among Docker guests and embedded applications.

Adding it to test against different libc.

[1]: https://alpinelinux.org/

Signed-off-by: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>
---
  tests/docker/dockerfiles/alpine.docker | 56 ++++++++++++++++++++++++++
  1 file changed, 56 insertions(+)
  create mode 100644 tests/docker/dockerfiles/alpine.docker

Unless one passes `NOUSER=1` as an argument (e.g. `make NOUSER=1 docker-image-alpine`) then the image build is going to fail due to the lack of useradd command on the base Alpine image. See the error below. As a result do build inside the container will fail (e.g. `make docker-test-build@alpine`). Apparently this issue can be solved by installing the "shadow" package in the image.

Without applying the patches 02-08 the build will fail on Alpine (tested with `make docker-test-build@alpine`). Actually patch 08 did not apply on master tree (error: patch failed: tests/migration/stress.c:174) so I could not successfully build it in the container.

I suggest that you move the patch 01 later on this series, just after all build issues are fixed so that it can be built inside the container.

---

$ make docker-image-alpine
  BUILD   alpine
Trying to pull registry.gitlab.com/qemu-project/qemu/qemu/alpine...
  manifest unknown: manifest unknown
Error: unable to pull registry.gitlab.com/qemu-project/qemu/qemu/alpine: Error initializing source docker://registry.gitlab.com/qemu-project/qemu/qemu/alpine:latest: Error reading manifest latest in registry.gitlab.com/qemu-project/qemu/qemu/alpine: manifest unknown: manifest unknown
/bin/sh: useradd: not found
Error: error building at STEP "RUN id wmoschet 2>/dev/null || useradd -u 1000 -U wmoschet": error while running runtime: exit status 127
Traceback (most recent call last):
  File "/home/wmoschet/src/qemu/tests/docker/docker.py", line 709, in <module>
    sys.exit(main())
  File "/home/wmoschet/src/qemu/tests/docker/docker.py", line 705, in main
    return args.cmdobj.run(args, argv)
  File "/home/wmoschet/src/qemu/tests/docker/docker.py", line 498, in run
    dkr.build_image(tag, docker_dir, dockerfile,
  File "/home/wmoschet/src/qemu/tests/docker/docker.py", line 353, in build_image
    self._do_check(build_args,
  File "/home/wmoschet/src/qemu/tests/docker/docker.py", line 244, in _do_check
    return subprocess.check_call(self._command + cmd, **kwargs)
  File "/usr/lib64/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['podman', 'build', '-t', 'qemu/alpine', '-f', '/tmp/docker_build063jqidd/tmpn9zbbxzu.docker', '--cache-from', 'registry.gitlab.com/qemu-project/qemu/qemu/alpine', '/tmp/docker_build063jqidd']' returned non-zero exit status 125. make: *** [/home/wmoschet/src/qemu/tests/docker/Makefile.include:62: docker-image-alpine] Error 1
---


diff --git a/tests/docker/dockerfiles/alpine.docker b/tests/docker/dockerfiles/alpine.docker
new file mode 100644
index 0000000000..a1b80f08d2
--- /dev/null
+++ b/tests/docker/dockerfiles/alpine.docker
@@ -0,0 +1,56 @@
+
+FROM alpine:edge
+
+RUN apk update
+RUN apk upgrade
+
+# Please keep this list sorted alphabetically
+ENV PACKAGES \
+	alsa-lib-dev \
+	bash \
+	bison \
+	build-base \
+	coreutils \
+	curl-dev \
+	flex \
+	git \
+	glib-dev \
+	glib-static \
+	gnutls-dev \
+	gtk+3.0-dev \
+	libaio-dev \
+	libcap-dev \
+	libcap-ng-dev \
+	libjpeg-turbo-dev \
+	libnfs-dev \
+	libpng-dev \
+	libseccomp-dev \
+	libssh-dev \
+	libusb-dev \
+	libxml2-dev \
+	linux-headers \
+	lzo-dev \
+	mesa-dev \
+	mesa-egl \
+	mesa-gbm \
+	meson \
+	ncurses-dev \
+	ninja \
+	paxmark \
+	perl \
+	pulseaudio-dev \
+	python3 \
+	py3-sphinx \
+	snappy-dev \

To solve the problem I mentioned above:

diff --git a/tests/docker/dockerfiles/alpine.docker b/tests/docker/dockerfiles/alpine.docker
index a1b80f08d2..5be5198d00 100644
--- a/tests/docker/dockerfiles/alpine.docker
+++ b/tests/docker/dockerfiles/alpine.docker
@@ -41,6 +41,7 @@ ENV PACKAGES \
        pulseaudio-dev \
        python3 \
        py3-sphinx \
+       shadow \
        snappy-dev \
        spice-dev \
        texinfo \

+	spice-dev \
+	texinfo \
+	usbredir-dev \
+	util-linux-dev \
+	vde2-dev \
+	virglrenderer-dev \
+	vte3-dev \
+	xfsprogs-dev \
+	zlib-dev \
+	zlib-static
+
+RUN apk add $PACKAGES




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux