Fixing `/proc/cpuinfo` on Rosetta
Description
I'm making a new issue following up on:
- https://github.com/docker/for-mac/issues/6047
- https://github.com/docker/for-mac/issues/6111
- https://github.com/docker/for-mac/issues/6512
because recent Docker Desktop for Mac releases no longer rely on QEMU.
The issues were closed as "blocked/upstream" pointing at this QEMU issue: https://gitlab.com/qemu-project/qemu/-/issues/750
However, now that Rosetta is used by default on latest macOS, the QEMU issue should no longer be blocking. However, it seems that the issue is still not fixed even when using Rosetta 2. Is there a new upstream issue, now in Rosetta? Or is QEMU still used to some extent?
Context: I'm trying to get k3s amd64 images to work but this fails as explained in this issue: https://github.com/k3s-io/k3s/issues/4720
Reproduce
- Make sure Rosetta 2 is enabled in settings in Docker Desktop
- Run
docker run -it --platform linux/amd64 alpine:latest cat /proc/cpuinfo
Expected behavior
I get the cpuinfo in the layout of the emulated system, looking somewhat like this:
processor : 0
vendor_id : AuthenticAMD
cpu family : 23
model : 1
model name : AMD Ryzen Threadripper 1900X 8-Core Processor
stepping : 1
microcode : 0x8001129
cpu MHz : 2180.123
cache size : 512 KB
physical id : 0
siblings : 16
core id : 0
cpu cores : 8
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 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate sme ssbd vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca
bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass
bogomips : 7599.04
TLB size : 2560 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 43 bits physical, 48 bits virtual
power management: ts ttp tm hwpstate eff_freq_ro [13] [14]
--- snip ---
Actual behavior:
I get
processor : 0
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp flagm2 frint
CPU implementer : 0x00
CPU architecture: 8
CPU variant : 0x0
CPU part : 0x000
CPU revision : 0
--- snip ---
docker version
Client:
Cloud integration: v1.0.35+desktop.5
Version: 24.0.6
API version: 1.43
Go version: go1.20.7
Git commit: ed223bc
Built: Mon Sep 4 12:28:49 2023
OS/Arch: darwin/arm64
Context: desktop-linux
Server: Docker Desktop 4.25.1 (128006)
Engine:
Version: master
API version: 1.44 (minimum version 1.12)
Go version: go1.21.3
Git commit: 0253fedf03f4964c20906795e119404633cb9c1a
Built: Thu Oct 19 08:35:54 2023
OS/Arch: linux/arm64
Experimental: true
containerd:
Version: 1.6.22
GitCommit: 8165feabfdfe38c65b599c4993d227328c231fca
runc:
Version: 1.1.8
GitCommit: v1.1.8-0-g82f18fe
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker info
Client:
Version: 24.0.6
Context: desktop-linux
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.11.2-desktop.5
Path: /Users/corneliusromer/.docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.23.0-desktop.1
Path: /Users/corneliusromer/.docker/cli-plugins/docker-compose
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.0
Path: /Users/corneliusromer/.docker/cli-plugins/docker-dev
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.20
Path: /Users/corneliusromer/.docker/cli-plugins/docker-extension
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v0.1.0-beta.9
Path: /Users/corneliusromer/.docker/cli-plugins/docker-init
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: /Users/corneliusromer/.docker/cli-plugins/docker-sbom
scan: Docker Scan (Docker Inc.)
Version: v0.26.0
Path: /Users/corneliusromer/.docker/cli-plugins/docker-scan
scout: Docker Scout (Docker Inc.)
Version: v1.0.9
Path: /Users/corneliusromer/.docker/cli-plugins/docker-scout
Server:
Containers: 34
Running: 20
Paused: 0
Stopped: 14
Images: 18
Server Version: master
Storage Driver: stargz
driver-type: io.containerd.snapshotter.v1
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 8165feabfdfe38c65b599c4993d227328c231fca
runc version: v1.1.8-0-g82f18fe
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
cgroupns
Kernel Version: 6.4.16-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: aarch64
CPUs: 10
Total Memory: 11.68GiB
Name: linuxkit-2ec2e4e73b30
ID: 2d9717eb-dd17-47cb-b40b-576d50e76161
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Experimental: true
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: false
WARNING: daemon is not using the default seccomp profile
Diagnostics ID
239B7F30-E6B8-4B1A-BC49-328E5B2FB8AA/20231115030111
Additional Info
If anyone has found a workaround for this general problem of kubernetes amd64 cluster on M1 mac let me know. I'm totally blocked right now.
This should be fixed! Many people complain about that online :-(
Limited workaround is to use colima instead of docker desktop, but with lots of downsides, e.g. more resource intensive, slower, less reliable etc.
Has anyone figured out a workaround for this issue? Unfortunately Supabase is not compatible with arm64 (at least not Bitnami's docker image for it), which means we need some way of emulating amd64 in our k3d environment.