I am building a base local development environment using docker-compose.yml and I want to include latest php-fpm version, the docker-compose.tml file as bellow:
version: "3.5"
services:
nginx:
image: nginx:alpine
container_name: ${PROJECT_NAME}-nginx
ports:
- "80:80"
volumes:
- "./code:/code"
- "./docker/nginx/vhost:/etc/nginx/conf.d/default.conf"
depends_on:
- php
networks:
- devproject
php:
build:
dockerfile: Dockerfile
context: ./docker/php
container_name: ${PROJECT_NAME}-php
ports:
- "9000:9000"
volumes:
- "./code:/code"
networks:
- devproject
networks:
devproject:
driver: bridge
./docker/php/Dockerfile:
FROM php:8.0.7-fpm-alpine3.14
RUN apk update && apk add \
curl-dev \
libzip-dev \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
libxml2-dev \
gettext-dev \
&& docker-php-ext-install -j$(nproc) mysqli pdo pdo_mysql zip gd mbstring xml curl json gettext tokenizer
I keep getting an error when docker try to get php image:
❯ docker-compose up -d
Building php
[+] Building 2.9s (4/4) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 38B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for docker.io/library/php:8.0.7-fpm-alpine3.14 2.8s
=> [auth] library/php:pull token for registry-1.docker.io 0.0s
------
> [internal] load metadata for docker.io/library/php:8.0.7-fpm-alpine3.14:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:a8409dff6597f2ef5f7ecd3c672671bb2af9a390073efd74f95c54aa41cba22a: not found
ERROR: Service 'php' failed to build : Build failed
Even if I try to pull the image individually: docker pull php:8.0.7-fpm-alpine3.14 I get another error:
❯ docker pull php:8.0.7-fpm-alpine3.14
8.0.7-fpm-alpine3.14: Pulling from library/php
no matching manifest for linux/amd64 in the manifest list entries
.env file:
PROJECT_NAME=myproject
DEV_DOMAIN=docker.local
I tried many different php versions but all give the above errors:
- php:fpm-alpine3.14
- php:alpine3.14
- php:8.1.0alpha1-fpm-alpine3.14
- php:7.4.20-fpm-alpine3.14
Is there an error in my docker-compose.yml or ./docker/php/Dockerfile?
I searched many sites and forums for similar errors and github issues (such as docker github issue) I tried all the suggested solutions but no luck, while there are many images working well without any issue (nginx, mysql, alpine)
I am using WSL2 for Windows 10 Pro and UBUNTU 20.04 distro