I’m using GitHub - multiarch/qemu-user-static: `/usr/bin/qemu-*-static` to run multi-arch docker containers on my runner host. That works great. However, upon attempting to do the same with the plugins/docker
container, in order to build an image for a different architecture, I get an error related to docker being unable to start within the container. The full log of that build step, including the error, is as follows:
+ /usr/local/bin/dockerd --data-root /var/lib/docker --host=unix:///var/run/docker.sock
Detected registry credentials
+ /usr/local/bin/docker version
time="2021-01-16T20:35:10Z" level=error msg="failure getting variant" error="getCPUInfo for pattern: Cpu architecture: not found"
Client: Docker Engine - Community
Version: 19.03.8
API version: 1.40
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:23:06 2020
OS/Arch: linux/arm64
Experimental: false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
time="2021-01-16T20:35:11Z" level=fatal msg="exit status 1"
I am running the linux-arm64
version (tag) of the docker plugin using the aforementioned qemu, and have installed both qemu-user
and qemu-user-static
on the host. Running the amd64 version of the plugin works fine. My config for this step is as follows:
- name: build and push docker images
image: plugins/docker:linux-arm64
# Neither of the below work - the former makes no difference, and the latter builds x86_64 images as expected, but not desired
#privileged: true
#volumes:
#- name: dockersock
# path: /var/run/docker.sock
settings:
username:
from_secret: DOCKER_USER
password:
from_secret: DOCKER_TOKEN
repo: <username>/<project-name>
tags: latest
dockerfile: Dockerfiledendrite-monolith-testing
context: ./bin/bin/linux_arm64/
It may be worth noting that from within the container (or other similarly configured ones), cat /proc/cpuinfo
produces:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-1630 v4 @ 3.70GHz
stepping : 1
microcode : 0x1
cpu MHz : 3699.996
cache size : 10240 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat md_clear
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit
bogomips : 7399.99
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
which seems to be the same as on the host.
This docker issue may also be relevant, although it is about running in a chroot: docker fails to start in chroot qemu environment (error: getCPUInfo) · Issue #1146 · docker/for-linux · GitHub
Is there any way around this? Alternatively, could a cross-build feature be added to the plugins/docker
container, possibly using buildx?