每次打开计算机,然后打开docker时,我都需要先删除容器,重置docker,然后运行docker-compose up
,因为容器不起作用。
当我运行docker时,容器正在运行,但是它们不起作用:
C:\docker\viland>docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
db53a5054516 viland_apache "/bin/sh -c 'apachec…" 16 hours ago Up 16 hours 0.0.0.0:80->80/tcp, 443/tcp apache
2873985c23cc viland_php "docker-php-entrypoi…" 16 hours ago Up 16 hours 9000/tcp php
尝试启动容器时,没有任何变化:
Starting php ... done
Starting apache ... done
每天都可以在docker上工作,我必须采取以下步骤:
docker-compose down
,docker-compose up
为什么我需要为每个容器删除容器,我需要重新创建它们?
docker-compose.yml
version: '3'
services:
apache:
build: .docker/apache
container_name: apache
ports:
- 80:80
volumes:
- .docker/config/vhosts:/etc/apache2/sites-enabled
- .:/home/wwwroot/viland
depends_on:
- php
php:
build:
context: .docker/php
args:
- WITH_XDEBUG=true
env_file:
- .env
container_name: php
volumes:
- .:/home/wwwroot/viland