我在一个项目中有多个Docker容器,我使用docker-compose up -d启动容器。
这是我的docker-compose.yml文件:
version: "3"
services:
httpd:
image: 'nginx:stable-alpine'
ports:
- '80:80'
volumes:
- ./laravel:/var/www/html
- ./.docker-config/nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- php
- mysql
networks:
- backstage
php:
build:
context: ./.docker-config/dockerfiles
dockerfile: php.dockerfile
volumes:
- ./laravel:/var/www/html:delegated
networks:
- backstage
mysql:
image: mysql:5.7
env_file:
- ./.docker-config/mysql/mysql.env
ports:
- '33060:3306'
networks:
- backstage
composer:
build:
context: ./.docker-config/dockerfiles
dockerfile: composer.dockerfile
volumes:
- ./laravel:/var/www/html
networks:
- backstage
artisan:
build:
context: ./.docker-config/dockerfiles
dockerfile: php.dockerfile
volumes:
- ./laravel:/var/www/html
entrypoint: ["php", "/var/www/html/artisan"]
depends_on:
- mysql
networks:
- backstage
npm:
image: node:14-alpine
working_dir: /var/www/html
entrypoint: ["npm"]
volumes:
- ./laravel:/var/www/html
networks:
- backstage
phpunit:
build:
context: ./.docker-config/dockerfiles
dockerfile: php.dockerfile
volumes:
- ./laravel:/var/www/html
entrypoint: ["vendor/bin/phpunit"]
networks:
- backstage正如您所看到的,我为phpunit容器定义了D4,但我不希望在运行docker-compose up -d时启动phpunit。
我怎么能这么做?
https://devops.stackexchange.com/questions/16128
复制相似问题