如何在docker-compose.yml中重建Docker容器? [英] How to rebuild docker container in docker-compose.yml?

查看:653
本文介绍了如何在docker-compose.yml中重建Docker容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在docker-compose.yml中定义了服务范围。这些服务已启动。我只需要重建其中之一,然后启动它即可启动其他服务。
我运行以下命令:

There are scope of services which defined in docker-compose.yml. These service have been started. I need to rebuild only one of these and start it without up other services. I run the following commands:

docker-compose up -d # run all services
docker-compose stop nginx # stop only one. but it still running !!!
docker-compose build --no-cache nginx 
docker-compose up -d --no-deps # link nginx to other services

最后,我得到了旧的nginx容器。
docker-compose不会杀死所有正在运行的容器!

At the end i got old nginx container. By the way docker-compose doesn't kill all running containers !

推荐答案

docker组成

$ docker-compose up -d --no-deps --build <service_name>



-不滴水-不要启动链接服务。

--no-deps - Don't start linked services.



-build-在启动容器之前构建映像。

--build - Build images before starting containers.

这篇关于如何在docker-compose.yml中重建Docker容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆