When using Docker to develop containers, an error occurs when using docker-compose.yml to build the development container with Dockerfile

When using Docker to develop containers, an error occurs when using docker-compose.yml to build the development container with Dockerfile

devcontainer.json
{
  "name": "PHP",
  "dockerComposeFile": "docker-compose.yml",
  service: "webman",
  "customizations": {
    "jetbrains": {
      "backend": "PhpStorm"
    }
  },
  "forwardPorts": [
    8080
  ]
}

docker-compose.yml

services:
    webman:
        build:
            context: .
            dockerfile: Dockerfile
        image: devcontainer-webman
        ports:
            - 8787:8787
        volumes:
            - ../:/app
        working_dir: /app
        networks:
            - 1panel-network

networks:
    1panel-network:
        external: true

 

Dockerfile

FROM php:8.3.4-cli-alpine


# Container package  : mirrors.163.com、mirrors.aliyun.com、mirrors.ustc.edu.cn
RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories
# RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g" /etc/apk/repositories

RUN apk update


RUN apk add curl
RUN apk add git

ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions

RUN install-php-extensions  bcmath
RUN install-php-extensions  pdo
RUN install-php-extensions  mysqli
RUN install-php-extensions  pdo_mysql
RUN install-php-extensions  redis

RUN install-php-extensions  @composer

RUN php -m

COPY php.ini /usr/local/etc/php/conf.d/zzz_custom.ini

# Make sure files/folders needed by the processes are accessable when they run under the nobody user
RUN chown -R nobody.nobody /run

# Setup document root
RUN mkdir -p /app

# Make the document root a volume
VOLUME /app

#echo " > /usr/local/etc/php/conf.d/phalcon.ini
# Switch to use a non-root user from here on
USER root

# Add application
WORKDIR /app

# Expose the port nginx is reachable on
EXPOSE 8787


# Let supervisord start nginx & php
CMD ["php", "/app/start.php", "start"]

 

 

 

#1 [internal] load local bake definitions
#1 reading from stdin 541B done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 1.97kB done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/library/php:8.3.4-cli-alpine
#3 DONE 0.5s

#4 [internal] load .dockerignore
#4 transferring context: 2B done
#4 DONE 0.0s

#5 [internal] load build context
#5 DONE 0.0s

#6 [ 1/30] FROM docker.io/library/php:8.3.4-cli-alpine@sha256:abe899a208ba676758312f0aea8aa76025b0b8d31caa92087e157650f8c8c650
#6 DONE 0.0s

#7 [ 6/30] ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
#7 DONE 0.4s

#5 [internal] load build context
#5 transferring context: 28B done
#5 DONE 0.0s

#8 [19/30] RUN #install-php-extensions  pdo_pgsql
#8 CACHED

#9 [18/30] RUN install-php-extensions  event
#9 CACHED

#10 [ 6/30] ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
#10 CACHED

#11 [15/30] RUN install-php-extensions  opcache
#11 CACHED

#12 [12/30] RUN install-php-extensions  redis
#12 CACHED

#13 [13/30] RUN install-php-extensions  bz2
#13 CACHED

#14 [16/30] RUN install-php-extensions  pcntl
#14 CACHED

#15 [ 5/30] RUN apk add git
#15 CACHED

#16 [14/30] RUN install-php-extensions  calendar
#16 CACHED

#17 [10/30] RUN install-php-extensions  mysqli
#17 CACHED

#18 [ 7/30] RUN chmod +x /usr/local/bin/install-php-extensions
#18 CACHED

#19 [ 8/30] RUN install-php-extensions  bcmath
#19 CACHED

#20 [26/30] RUN curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer
#20 CACHED

#21 [24/30] RUN install-php-extensions  @composer
#21 CACHED

#22 [20/30] RUN #install-php-extensions  pgsql
#22 CACHED

#23 [29/30] RUN mkdir -p /app
#23 CACHED

#24 [ 4/30] RUN apk add curl
#24 CACHED

#25 [27/30] COPY php.ini /usr/local/etc/php/conf.d/zzz_custom.ini
#25 CACHED

#26 [28/30] RUN chown -R nobody.nobody /run
#26 CACHED

#27 [ 2/30] RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories
#27 CACHED

#28 [11/30] RUN install-php-extensions  pdo_mysql
#28 CACHED

#29 [ 3/30] RUN apk update
#29 CACHED

#30 [21/30] RUN install-php-extensions  zip
#30 CACHED

#31 [23/30] RUN install-php-extensions  xdebug
#31 CACHED

#32 [17/30] RUN install-php-extensions  sockets
#32 CACHED

#33 [22/30] RUN install-php-extensions  gd
#33 CACHED

#34 [25/30] RUN php -m
#34 CACHED

#35 [ 9/30] RUN install-php-extensions  pdo
#35 CACHED

#36 [30/30] WORKDIR /app
#36 CACHED

#37 exporting to image
#37 exporting layers done
#37 writing image sha256:580535a360b941705137779ffd076b2691e91a571813ee55c8d216b28a5acb0e done
#37 naming to docker.io/library/devcontainer-webman done
#37 DONE 0.0s

#38 resolving provenance for metadata file
#38 DONE 0.0s
[+] Building 1/1
✔ devcontainer-webman  Built                                                              0.0s 
Cannot build docker compose image.

 

I want to know where I made a mistake

0

Please sign in to leave a comment.