Dockerfile icon indicating copy to clipboard operation
Dockerfile copied to clipboard

webdevops/php-nginx-dev:latest

Open halimbsd opened this issue 3 years ago • 1 comments
trafficstars

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

halimbsd avatar Jan 11 '22 01:01 halimbsd

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

f15u avatar Jan 14 '22 15:01 f15u

I have an image patch installed. But from a few days to the problem is again.

ghost avatar Sep 28 '22 10:09 ghost

Just fixed it be updating gosu and go-replace

htuscher avatar Mar 31 '23 12:03 htuscher

Just fixed it be updating gosu and go-replace

This means we can remove the previous code from our Dockerfile?

f15u avatar Mar 31 '23 17:03 f15u