本文介绍了如何使用docker-compose重新启动单个容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 docker-compose.yml 文件,其中包含4个容器:redis,postgres,api,worker



worker )而不重新启动其他容器?

解决方案这很简单:使用命令:

  docker-compose restart worker 

您可以设置等待停止的时间,然后再杀死容器(以秒为单位)

  docker-compose restart -t 30 worker 

全部!


I have a docker-compose.yml file that contains 4 containers: redis, postgres, api, worker

During the development of worker, I often need to restart it in order to apply changes. Is there any good way to restart a container (e.g. worker) without restarting the other containers?

解决方案

It is very simple: Use the command:

docker-compose restart worker

You can set the time to wait for stop before killing the container (in seconds)

docker-compose restart -t 30 worker

Thats all !

这篇关于如何使用docker-compose重新启动单个容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 11:44