docker-compose upPriority will be given to using existing containers instead of creating new ones.
The following method can solve your problem:
docker-compose up -d --force-recreate 使用 --force-recreate You can force the container to be rebuilt (otherwise the container will only be rebuilt when the container configuration changes)
docker-compose down Stop all containers and delete the container (so it will be a new container the next time you use docker-compose down 停止所有容器,并删除容器 (这样下次使用docker-compose up)
docker-compose up is to create and start a container. As far as I know, there are only three situations where the container will be re-created (that is, the old container will be deleted first, and then a new one will be generated): 1. When the image is updated, the container will be re-created. Re-create the container; 2. The container does not exist (that is, it has been deleted); 3. When container A is re-created, the containers that depend on this container will be re-created (that is, the container in the docker-compose.yml file is set depends_on is the container of container A)
docker-compose up
Priority will be given to using existing containers instead of creating new ones.The following method can solve your problem:
docker-compose up -d --force-recreate
使用--force-recreate
You can force the container to be rebuilt (otherwise the container will only be rebuilt when the container configuration changes)docker-compose down
Stop all containers and delete the container (so it will be a new container the next time you usedocker-compose down
停止所有容器,并删除容器 (这样下次使用docker-compose up
)docker-compose up is to create and start a container. As far as I know, there are only three situations where the container will be re-created (that is, the old container will be deleted first, and then a new one will be generated):
1. When the image is updated, the container will be re-created. Re-create the container;
2. The container does not exist (that is, it has been deleted);
3. When container A is re-created, the containers that depend on this container will be re-created (that is, the container in the docker-compose.yml file is set depends_on is the container of container A)