Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add apple M1 support #465

Closed
seoplague opened this issue Dec 18, 2020 · 44 comments
Closed

Add apple M1 support #465

seoplague opened this issue Dec 18, 2020 · 44 comments
Assignees

Comments

@seoplague
Copy link

Hi I couldn't run a docker4drupal on my mac mini 2020.
I saw the following errors in Docker Preview and a few containers don't start:

runtime: failed to create new OS thread (have 2 already; errno=22) fatal error: newosproc runtime stack: runtime.throw(0x6249a0, 0x9) /home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/panic.go:530 +0x90 runtime.newosproc(0xc820026000, 0xc820035fc0) /home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/os1_linux.go:149 +0x18c runtime.newm(0x676240, 0x0) /home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:1513 +0x135 runtime.main.func1() /home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:125 +0x2c runtime.systemstack(0x732c00) /home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/asm_amd64.s:291 +0x79 runtime.mstart() /home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:1048 goroutine 1 [running]: runtime.systemstack_switch() /home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/asm_amd64.s:245 fp=0xc820020770 sp=0xc820020768 runtime.main() /home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:126 +0x62 fp=0xc8200207c0 sp=0xc820020770 runtime.goexit()

`7bb04920b06f wodby/nginx:1.19-5.10.11 "/docker-entrypoint.…" About an hour ago Exited (2) 15 seconds ago lam_nginx

16fc6ea2acce wodby/drupal-php:7.4-dev-macos-4.21.3 "/docker-entrypoint.…" About an hour ago Exited (2) 15 seconds ago lam_php

2723a7d1e36e wodby/mariadb:10.5-3.9.7 "/docker-entrypoint.…" About an hour ago Exited (2) 16 seconds ago lam_mariadb

301543dc844a wodby/drupal-php:7.4-dev-macos-4.21.3 "/docker-entrypoint.…" 2 hours ago Exited (2) 15 seconds ago lam_crond

3648339359f1 phpmyadmin/phpmyadmin "/docker-entrypoint.…" 2 hours ago Up 16 seconds 80/tcp lam_pma

1099208ed106 portainer/portainer "/portainer --no-aut…" 2 hours ago Up 19 seconds 9000/tcp lam_portainer

e3c3d534a66b mailhog/mailhog "MailHog" 2 hours ago Up 18 seconds 1025/tcp, 8025/tcp lam_mailhog

f37a77a5c8d1 traefik:v2.0 "/entrypoint.sh --ap…" 2 hours ago Up 18 seconds 0.0.0.0:80->80/tcp lam_traefik`

@VA-PLE
Copy link

VA-PLE commented Jan 5, 2021

@sensedrive
Copy link

@VA-PLE I think he already mentioned that he is using the preview build of docker for M1.

@seoplague Did you get it running? I am looking forward to hear positive news.

I am not really into it, what it means to change to Apple Silicon regarding docker4drupal. So, if anyone has news feel free to share it here.

@ghalusa
Copy link

ghalusa commented Jan 21, 2021

Same issue with:

wodby/drupal-php:7.4-dev-macos-4.21.6
wodby/mariadb:10.5-3.10.0
wodby/nginx:1.19-5.11.0

Also being reported on Docker Desktop for Mac (docker/for-mac):
docker/for-mac#5170

runtime: failed to create new OS thread (have 2 already; errno=22)
fatal error: newosproc

runtime stack:
runtime.throw(0x6249a0, 0x9)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/panic.go:530 +0x90
runtime.newosproc(0xc82002e000, 0xc82003dfc0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/os1_linux.go:149 +0x18c
runtime.newm(0x676240, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:1513 +0x135
runtime.main.func1()
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:125 +0x2c
runtime.systemstack(0x732c00)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/asm_amd64.s:291 +0x79
runtime.mstart()
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:1048

goroutine 1 [running]:
runtime.systemstack_switch()
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/asm_amd64.s:245 fp=0xc820028770 sp=0xc820028768
runtime.main()
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:126 +0x62 fp=0xc8200287c0 sp=0xc820028770
runtime.goexit()
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc8200287c8 sp=0xc8200287c0

@sensedrive
Copy link

@ghalusa Did you try to change the docker-compose file in order to build the container for the right platform?

@see https://stackoverflow.com/questions/65456814/docker-apple-silicon-m1-preview-mysql-no-matching-manifest-for-linux-arm64-v8

@ghalusa
Copy link

ghalusa commented Jan 21, 2021

@sensedrive Thank you for the suggestion. I just tried adding platform: linux/amd64 to docker-compose.ymlwith no luck... same error.

php:
    platform: linux/amd64
    image: wodby/drupal-php:$PHP_TAG
---- SNIP ----
runtime: failed to create new OS thread (have 2 already; errno=22)
fatal error: newosproc
---- SNIP ----

@sensedrive
Copy link

Thank you for testing @ghalusa

I found another thread about building images for the right platform, which sounds more promising. Unfortunately I cannot test by myself. Maybe you could give it a try again.

@see docker/roadmap#142

@tregouetkevin
Copy link

tregouetkevin commented Feb 3, 2021

i have the same issue, but i'm not sure its docker4mac but its images in docker4drupal.

Image need to be for ARM64, i have change the php / nginx / mariadb image for match with the arm64 and docker4mac build all my container.

So maybe need to update the wodby images of apache / mariadb / nginx / cron for compatibility with arm64 ?

But all images are based on alpine who support normaly arm64

@ghalusa
Copy link

ghalusa commented Feb 4, 2021

@tregouetkevin I believe this is accurate. After further investigation, I've arrived at the same conclusion. Thanks!

@JanLaureys
Copy link

Just wanted to mention that this still happens on the last preview build of Docker for mac.

Tried to work around it this weekend as well by replacing different containers with their original base alpine equivalent, I did get a few containers up and running but didn't succeed in configuring them properly. Kind of sad as this makes my new M1 Macbook Air kind of useless for now.

Seeing that @csandanov self-assigned it does make me a little hopeful.

@tregouetkevin
Copy link

Yes i have try to do the same but there is a lot of work for configuring every container...

i hope too @csandanov ll solve this soon :(

@csandanov
Copy link
Member

php (-dev-macos), mariadb and nginx images now have linux/arm64 platform support, please test and let me know how it works

@tregouetkevin
Copy link

tregouetkevin commented Feb 22, 2021

php:
image: wodby/drupal-php:$PHP_TAG-dev-macos
container_name: "${PROJECT_NAME}_php"

Pulling php (wodby/drupal-php:7.3-dev-macos)... 7.3-dev-macos: Pulling from wodby/drupal-php 069a56d6d07f: Pull complete 2e4b642bcaae: Pull complete 06ea39643e14: Pull complete b3455119714d: Pull complete 0d5a56db2ce0: Pull complete 3faf3e8d8d35: Pull complete ec9ee677d406: Pull complete 9f6cad06ec2c: Pull complete 4043806dd895: Pull complete 60bd2ccaf66e: Pull complete f1a986363198: Pull complete 8929b4d3563d: Pull complete 3b68de5c40d5: Pull complete 0ee28107940d: Pull complete ac5c42622fd6: Pull complete 98310b66e3f4: Pull complete 8f0f6e059699: Pull complete f6ae375ed954: Pull complete Digest: sha256:cff0cbcfd9af5132ce4af30af0cc525d2f78f479f06e681fd488618f83e1ab86 Status: Downloaded newer image for wodby/drupal-php:7.3-dev-macos

i have the same error :
runtime: failed to create new OS thread (have 2 already; errno=22) fatal error: newosproc runtime stack:

@csandanov
Copy link
Member

@tregouetkevin are you using the latest edge version of docker for mac?

@tregouetkevin
Copy link

@csandanov i use this docker4mac https://ibb.co/yYrFT3Q

@csandanov
Copy link
Member

@tregouetkevin ok, looks like the latest preview build and I assume you have rosetta 2 installed. Maybe anything useful under ~/Library/Containers/com.docker.docker/Data/vms/0/console.log as noted at https://docs.docker.com/docker-for-mac/apple-m1/? Does this also happen with nginx/mariadb?

@csandanov
Copy link
Member

@tregouetkevin and just to make sure where's the issue, could you please try running the official php image:

docker run --rm php:7.3.27-fpm-alpine

@tregouetkevin
Copy link

Do you want a teamviewer on my mac ?

@tregouetkevin
Copy link

docker run --rm php:7.3.27-fpm-alpine this work

@tregouetkevin
Copy link

Same error with mariadb

@JanLaureys
Copy link

JanLaureys commented Feb 22, 2021

Tried again on latest version of Docker For Mac M1 Preview (3.1.0 build 60984) with latest version of master branch of this repo. Same error still. I also installed rosetta2 again.

Ran make up without changing anything to the .env or docker-compose file and only portainer, mailhog and traefik containers were running. Output of make up and docker ps -a and make logs

Don't notice anything too crazy in the console.log file. Pasted my file in a gist. (Fresh Docker Install and make up).

docker run --rm php:7.3.27-fpm-alpine works as I would expect.
docker run --rm mariadb crashed docker daemon and forced me to factory reset. (No big deal tho).
docker pull mariadb --platform=linux/arm64 && docker run --name mariadb_container -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mariadbdoes work.
docker run nginx:alpine works as I would expect
After a docker system prune: docker pull nginx:alpine --platform=linux/arm64 && docker run nginx:alpine works as well.

Edit: Not trying to be a negative nancy, just sharing my findings.

@petergr
Copy link

petergr commented Feb 23, 2021

I'm having basically the exact same issues as JanLaureys there.

@ocean
Copy link

ocean commented Feb 24, 2021

I am attacking a similar issue as this, after getting a new M1 MBP last week (but using a different set of containers, Amazee Lagoon - a similar themed Drupal-focused stack). I got here after frustratedly searching for the same string fatal error: newosproc runtime stack 😁

The issue is within the container images, and their upstream builds. If you look at the Dockerfile e.g. for the Wodby php image, https://github.com/wodby/php/blob/master/8/Dockerfile it has quite a few amd64 specific libraries and utilities, though some progress has been made, for instance using $BUILDPLATFORM to download an architecture-specific version of the gotpl tool into the container.

I've embarked on a "recompile the world" quest to get my stack working, and I'll post back here if I have any useful things to share. In the meantime, the best everyone can do is dig in and try and get each part building, piece by piece. If one container doesn't work, find its upstream and try and get that working. If something isn't available for linux/arm64 (the architecture that Docker for Mac uses, and what is shown in $BUILDPLATFORM), then try and see if you can rebuild it for that architecture.

Good luck and go build! 😄

@csandanov
Copy link
Member

csandanov commented Feb 24, 2021

I've released fixes for most of the images except mariadb, could you please test it again with M1. I'm testing on aws graviton and it works fine there. Indeed there was an issue with the gotpl but it now has arm64 support, the rest of tools shouldn't be the issue as they're not used in local environment. Since we're using qemu to compile arm64 images it takes a lot of time and for MariaDB it hit a gh actions execution time limit (6 hours), we're trying to offload arm64 builds to self-hosted runners on graviton now.

@tregouetkevin
Copy link

tregouetkevin commented Feb 24, 2021

@csandanov wow thank a lot that work ! i have try php and it run on my mac m1

@tregouetkevin
Copy link

i have only 2 containers, like you have said mariadb and apache who is down.

@csandanov
Copy link
Member

Just released apache fix, arm64 variant was missing

@tregouetkevin
Copy link

Apache doesn’t work for me

@csandanov
Copy link
Member

csandanov commented Feb 24, 2021

@tregouetkevin if you pulled the image before it might already downloaded amd64 image, you should delete it via docker rmi [id] (get id from docker images) and pull it again to fetch arm64 version

@tregouetkevin
Copy link

@csandanov yes i remove all image before my make up.
I did it again but i have still the same error on apache container

@tregouetkevin
Copy link

-dev-macos flag is just for php right ?

@csandanov
Copy link
Member

@tregouetkevin , yes macos tags only for php. Could you please share error logs for apache

@tregouetkevin
Copy link

tregouetkevin commented Feb 24, 2021

Here the logs of apache container

runtime: failed to create new OS thread (have 2 already; errno=22)

fatal error: newosproc


runtime stack:

runtime.throw(0x6249a0, 0x9)

/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/panic.go:530 +0x90

runtime.newosproc(0xc820028000, 0xc820037fc0)

/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/os1_linux.go:149 +0x18c

runtime.newm(0x676240, 0x0)

/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:1513 +0x135

runtime.main.func1()

/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:125 +0x2c

runtime.systemstack(0x732c00)

/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/asm_amd64.s:291 +0x79

runtime.mstart()

/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:1048


goroutine 1 [running]:

runtime.systemstack_switch()

/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/asm_amd64.s:245 fp=0xc820022770 sp=0xc820022768

runtime.main()

/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:126 +0x62 fp=0xc8200227c0 sp=0xc820022770

runtime.goexit()

/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc8200227c8 sp=0xc8200227c0

@csandanov
Copy link
Member

@tregouetkevin could you please run the following command and show the output:

docker inspect $(docker images | grep "wodby/apache" | awk '{ print $3 }') -f '{{.Architecture}}'

also, does it fail if you simply run:

docker run --rm -ti wodby/apache sh

@tregouetkevin
Copy link

docker inspect $(docker images | grep "wodby/apache" | awk '{ print $3 }') -f '{{.Architecture}}'

arm64
amd64

docker run --rm -ti wodby/apache sh
i can connect to the container

@tregouetkevin
Copy link

Capture d’écran 2021-02-24 à 18 20 32

Capture d’écran 2021-02-24 à 18 20 37

Capture d’écran 2021-02-24 à 18 21 31

@tregouetkevin
Copy link

apache:
image: wodby/apache:$APACHE_TAG
container_name: "${PROJECT_NAME}_apache"
depends_on:
- php

@csandanov
Copy link
Member

@tregouetkevin you have two images of apache both for arm64 and amd64, maybe your docker uses amd64 over arm64 for whatever reason, you should delete the one for amd64.

Run the following command:

docker inspect $(docker images | grep "wodby/apache" | awk '{ print $3 }') -f '{{.Architecture}}{{.ID}}'

you should have output like:

amd64sha256:[ID]
arm64sha256:[ID]

Copy ID for amd64 and delete via docker rmi [ID]

@tregouetkevin
Copy link

Capture d’écran 2021-02-24 à 18 34 02

Every time i pull, i have the 2 images for apache

@csandanov
Copy link
Member

actually you apache image is old, use wodby/apache:2.4-4.3.8 or pull latest wodby/apache:2.4

@tregouetkevin
Copy link

Oh you right, all is good on apache with the latest version ! thank a lot

@petergr
Copy link

petergr commented Feb 25, 2021

Great work @csandanov! A big thanks from here.

Redis and Mariadb are not running Wodby versions, and these seem not to work quite yet as mentioned above. Either way, I got my environment up and running using library versions for these two - the other packages work well.

@csandanov
Copy link
Member

Latest tags of mariadb, redis, drupal-php (including non -dev-macos variants) and drupal (vanilla) now all support linux/arm64

@petergr
Copy link

petergr commented Feb 25, 2021

I can confirm that at least mariadb, redis, drupal-php and nginx packages work now.

@tregouetkevin
Copy link

Same for me everything is working, great job @csandanov thank a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants