Dockerfile icon indicating copy to clipboard operation
Dockerfile copied to clipboard

Apple Silicon M1 ARM problem

Open lukbsk opened this issue 4 years ago • 17 comments

Tried run on Apple Silicon, M1. I have installed latest golang from website go1.16.darwin-arm64.pkg (released few yours ago) but still doesn't work. Docker try use go 1.8.1. Any ideas?

-> Executing /opt/docker/provision/entrypoint.d/05-permissions.sh
-> Executing /opt/docker/provision/entrypoint.d/10-php-debugger.sh
PHP-Debugger: not specified - default is xdebug
- Removing PHP module blackfire
-> Executing /opt/docker/provision/entrypoint.d/20-nginx-dev.sh
runtime: failed to create new OS thread (have 2 already; errno=22)
fatal error: newosproc
runtime stack:
runtime.throw(0x6430dc, 0x9)
/usr/local/Cellar/go/1.8.1/libexec/src/runtime/panic.go:596 +0x95
runtime.newosproc(0xc420032000, 0xc420042000)
/usr/local/Cellar/go/1.8.1/libexec/src/runtime/os_linux.go:163 +0x18c
runtime.newm(0x650dd0, 0x0)
/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:1628 +0x137
runtime.main.func1()
/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:126 +0x36
runtime.systemstack(0x75bb00)
/usr/local/Cellar/go/1.8.1/libexec/src/runtime/asm_amd64.s:327 +0x79
runtime.mstart()
/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:1132
goroutine 1 [running]:
runtime.systemstack_switch()
/usr/local/Cellar/go/1.8.1/libexec/src/runtime/asm_amd64.s:281 fp=0xc42002e788 sp=0xc42002e780
runtime.main()
/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:127 +0x6c fp=0xc42002e7e0 sp=0xc42002e788
runtime.goexit()
/usr/local/Cellar/go/1.8.1/libexec/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc42002e7e8 sp=0xc42002e7e0

lukbsk avatar Feb 16 '21 22:02 lukbsk

Same problem here

silviokennecke avatar Feb 22 '21 18:02 silviokennecke

Same problem here

fukuda-takeshi-unimedia avatar Feb 26 '21 16:02 fukuda-takeshi-unimedia

Same problem.

RobertHR avatar Feb 28 '21 18:02 RobertHR

same here...

Runner668 avatar Mar 18 '21 21:03 Runner668

same here !

Pablo-Camara avatar Mar 19 '21 17:03 Pablo-Camara

In my Dockerfile I added: RUN wget -O "/usr/local/bin/go-replace" "https://github.com/webdevops/goreplace/releases/download/1.1.2/gr-arm64-linux" \ && chmod +x "/usr/local/bin/go-replace" \ && "/usr/local/bin/go-replace" --version

KornelKrupa avatar Mar 29 '21 09:03 KornelKrupa

i got error when add your line #6 3.775 2021-04-02 04:52:35 (2.61 MB/s) - ‘/usr/local/bin/go-replace’ saved [3671714/3671714] #6 3.775 #6 3.777 --2021-04-02 04:52:35-- http://%20/ #6 3.777 Resolving ( )... failed: Name or service not known. #6 3.777 wget: unable to resolve host address ‘ ’ #6 3.778 FINISHED --2021-04-02 04:52:35-- #6 3.778 Total wall clock time: 2.8s #6 3.778 Downloaded: 1 files, 3.5M in 1.3s (2.61 MB/s)

After I separated that line and it worked. RUN wget -O "/usr/local/bin/go-replace" "https://github.com/webdevops/goreplace/releases/download/1.1.2/gr-arm64-linux" RUN chmod +x "/usr/local/bin/go-replace" RUN "/usr/local/bin/go-replace" --version

Tks @KornelKrupa

nK2708 avatar Apr 02 '21 05:04 nK2708

@nK2708 could you please show a little more of your Dockerfile ? I was using the image: webdevops/... directly in the docker compose, I've tried using a Docker file and adding

FROM webdevops/php-apache...

RUN wget -O "/usr/local/bin/go-replace" "https://github.com/webdevops/goreplace/releases/download/1.1.2/gr-arm64-linux" RUN chmod +x "/usr/local/bin/go-replace" RUN "/usr/local/bin/go-replace" --version

and that does not seem to be enough to get it working, would you be so kind and guide me on how you made it ? @nK2708

Thanks in advance

Pablo-Camara avatar Apr 05 '21 09:04 Pablo-Camara

@Pablo-Camara

you can try these, I've modified Dockerfiles from webdevops/Dockfile, and now worked on my M1.

https://github.com/Runner668/php-7.4 https://github.com/Runner668/php-apache-7.4 https://github.com/Runner668/php-apache-dev-7.4

Runner668 avatar Apr 05 '21 10:04 Runner668

Thanks @KornelKrupa - works for webdevops/php-nginx:7.4 & webdevops/nginx:alpine.

This is the entirety of a working dockerfile as an example for webdevops/php-nginx:7.4:

FROM webdevops/php-nginx:7.4

RUN wget -O "/usr/local/bin/go-replace" "https://github.com/webdevops/goreplace/releases/download/1.1.2/gr-arm64-linux" \
    && chmod +x "/usr/local/bin/go-replace" \
    && "/usr/local/bin/go-replace" --version

Wilkolicious avatar May 07 '21 19:05 Wilkolicious

i have the same issue with webdevops/php-apache-dev:7.3-alpine is this going to be updated to work with m1 too?

kritop avatar Jun 15 '21 12:06 kritop

@Pablo-Camara

you can try these, I've modified Dockerfiles from webdevops/Dockfile, and now worked on my M1.

https://github.com/Runner668/php-7.4 https://github.com/Runner668/php-apache-7.4 https://github.com/Runner668/php-apache-dev-7.4

How exactly do I use this? I'm using a docker-compose file to set up my dev environment and running into the same problems on my Macbook Air (M1). If I want to use your adjusted files, how exactly do I go about this?

Excuse me the ignorance.

yereth avatar Aug 04 '21 07:08 yereth

@yereth just add image:runner668/php-apache:7.4 (or the other images, like php-apache-dev:7.4) in your compose file.

Runner668 avatar Aug 04 '21 09:08 Runner668

Hi @Wilkolicious

I added your line in my dockerfile but its still getting error.

This my dockerfile.

Could you please help to check it

`FROM webdevops/php-nginx:7.4

RUN wget -O "/usr/local/bin/go-replace" "https://github.com/webdevops/goreplace/releases/download/1.1.2/gr-arm64-linux"
&& chmod +x "/usr/local/bin/go-replace"
&& "/usr/local/bin/go-replace" --version

RUN apt-get update && apt-get install -y --no-install-recommends
curl
build-essential
&& apt-get -y install gcc make autoconf libc-dev pkg-config
&& apt-get -y install libmcrypt-dev

RUN pecl install xdebug-beta
&& docker-php-ext-enable xdebug
&& pecl install mcrypt-1.0.4
&& docker-php-ext-enable mcrypt

Install composer

RUN mkdir /opt/composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/opt/composer
&& curl -sL https://deb.nodesource.com/setup_8.x | bash -
&& apt-get install -y nodejs --no-install-recommends
&& rm -rf /var/lib/apt/lists/*
&& apt-get remove -y curl

RUN echo session.save_handler = redis >> /opt/docker/etc/php/php.ini RUN echo session.save_path = "tcp://redis:6379" >> /opt/docker/etc/php/php.ini RUN rm /etc/nginx/conf.d/*

USER application:application WORKDIR /var/www/html EXPOSE 80`

Thank in advance @Wilkolicious w

se7ven214 avatar Aug 04 '21 18:08 se7ven214

@yereth just add image:runner668/php-apache:7.4 (or the other images, like php-apache-dev:7.4) in your compose file.

That worked as far as syntax goes, but it never managed to download anything. Either got stuck in "15cb40b9c4df Pulling fs layer" or it gave me an error that said:

Error response from daemon: Head https://registry-1.docker.io/v2/runner668/php-apache/manifests/7.4: Get https://auth.docker.io/token?account=yereth&scope=repository%3Arunner668%2Fphp-apache%3Apull&service=registry.docker.io: net/http: request canceled (Client.Timeout exceeded while awaiting headers)

yereth avatar Aug 05 '21 02:08 yereth

Just wondering if there's any updates on M1 support or if there's anything we might be able to help with?

minorOffense avatar May 02 '22 14:05 minorOffense

gvh           | runtime: failed to create new OS thread (have 2 already; errno=22)
gvh           | fatal error: newosproc
gvh           |
gvh           | runtime stack:
gvh           | runtime.throw(0x6430dc, 0x9)
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/panic.go:596 +0x95
gvh           | runtime.newosproc(0xc42002a000, 0xc42003a000)
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/os_linux.go:163 +0x18c
gvh           | runtime.newm(0x650dd0, 0x0)
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:1628 +0x137
gvh           | runtime.main.func1()
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:126 +0x36
gvh           | runtime.systemstack(0x75bb00)
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/asm_amd64.s:327 +0x79
gvh           | runtime.mstart()
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:1132
gvh           |
gvh           | goroutine 1 [running]:
gvh           | runtime.systemstack_switch()
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/asm_amd64.s:281 fp=0xc420026788 sp=0xc420026780
gvh           | runtime.main()
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:127 +0x6c fp=0xc4200267e0 sp=0xc420026788
gvh           | runtime.goexit()
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc4200267e8 sp=0xc4200267e0
gvh exited with code 2

Please help! not able to run on m1 machine. facing above error.

saloniuppal avatar May 06 '22 22:05 saloniuppal

Does anyone know if there is any plan to support ARM somewhen?

If it's not on the roadmap that's okay but I would at least love to know so I can look for alternatives or start writing my own images

rico-ocepek avatar Sep 28 '22 14:09 rico-ocepek

Is there an update or an alternative image to use?

jdaehne avatar Oct 06 '22 19:10 jdaehne

Going to join the wagon here, need this fix to continue using this package. Unfortunately, I'm no docker pro to dive in and help directly but I am on hand to help in any way I can.

@Runner668 any chance of a php-nginx:7.4 version? Great work on getting the apache one up, it's working exactly as expected.

jamiedruce avatar Oct 13 '22 09:10 jamiedruce

There is a MR available since a couple of months now, but no one seems to be able to review and merge it ... https://github.com/webdevops/Dockerfile/pull/434 We are swiching our projects to DDEV now.

smxsm avatar Oct 13 '22 09:10 smxsm

We’re getting an M2 Mac Mini shortly (should be here by the end of February) as a test and build machine. We can donate some compute time to build and test that PR if the maintainer is interested.

In the meantime we’ve been using these images on M1 MacBook Pro machines with a flag in a docker file to swap a go library and run apt update to get a compatible version of OpenSSL.

Have a look here: https://gitlab.com/dropfort/dropfort_build/-/blob/5.x/assets/development/docker/build/web.dockerfile#L36

minorOffense avatar Feb 18 '23 18:02 minorOffense

Just fixed it be updating gosu and go-replace

htuscher avatar Mar 31 '23 12:03 htuscher

gvh           | runtime: failed to create new OS thread (have 2 already; errno=22)
gvh           | fatal error: newosproc
gvh           |
gvh           | runtime stack:
gvh           | runtime.throw(0x6430dc, 0x9)
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/panic.go:596 +0x95
gvh           | runtime.newosproc(0xc42002a000, 0xc42003a000)
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/os_linux.go:163 +0x18c
gvh           | runtime.newm(0x650dd0, 0x0)
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:1628 +0x137
gvh           | runtime.main.func1()
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:126 +0x36
gvh           | runtime.systemstack(0x75bb00)
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/asm_amd64.s:327 +0x79
gvh           | runtime.mstart()
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:1132
gvh           |
gvh           | goroutine 1 [running]:
gvh           | runtime.systemstack_switch()
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/asm_amd64.s:281 fp=0xc420026788 sp=0xc420026780
gvh           | runtime.main()
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:127 +0x6c fp=0xc4200267e0 sp=0xc420026788
gvh           | runtime.goexit()
gvh           | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc4200267e8 sp=0xc4200267e0
gvh exited with code 2

Please help! not able to run on m1 machine. facing above error.

I'm facing this same issue on Apple Silicon M2 ARM. This is my config on my docker-compose.yml file

version: "3" services: web: platform: linux/amd64 image: webdevops/php-apache-dev:7.2

Any idea of how to fix it? i'll be very gratefull. I'm new on macos and docker

georiv avatar Aug 07 '23 01:08 georiv