Dockerfile
Dockerfile copied to clipboard
webdevops/php-nginx-dev:latest
has been use this image webdevops/php-nginx-dev:latest on my intel macbook and have no issue, but in M1 chip i got this error
runtime: failed to create new OS thread (have 2 already; errno=22) ngix_web | fatal error: newosproc,
any tips or trick to solve this issue, on M1 chip mac
If you plan to use it only locally on your Mac, you can add this on top of your Dockerfile:
RUN set -eux; \
wget --quiet -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;
In case you need to build it for multi-architecture, you can use build args and add on your Dockerfile:
// ...
ARG ARCHITECTURE="linux/amd64"
// ...
RUN set -eux; \
if [ "$ARCHITECTURE" = "linux/arm64" ]; then \
wget --quiet -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; \
fi
// ...
And build it with --build-arg:
docker image build --build-arg "linux/arm64" .
Or with docker-compose:
services:
your-service:
build:
args:
ARCHITECTURE: "linux/arm64"
# ...
# ...
I'm using this approach for like an year and it is working very well for me and my team.
Currenctly I work with both amd and m1.
EDIT: Found the issue where found inspiration for the fix #395
I have an image patch installed. But from a few days to the problem is again.
Just fixed it be updating gosu and go-replace
Just fixed it be updating gosu and go-replace
This means we can remove the previous code from our Dockerfile?