Docker守护程序重新启动并重新附加到容器 [英] Docker daemon restart and reattaching to containers

查看:202
本文介绍了Docker守护程序重新启动并重新附加到容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我杀死了docker daemon进程然后重新启动它,则正在运行的所有容器现在都以 Exited 状态列出,并且无法使用docker-compose重新启动,因为它会抱怨容器名称已经存在

If I kill my docker daemon process and then restart it, any containers that were running are now listed with Exited status and cannot be restarted using docker-compose as it will complain about the container name already being in use.

可以使用docker start重新启动Docker容器,但是当您有很多容器时,这可能很难。

Docker containers can be started again using docker start but this could be hard when you've many containers.

有什么方法可以重启docker守护进程,保持容器运行(以免干扰流量)并使守护进程重新连接到容器上吗?

Is there any way to restart the docker daemon, leave containers running (so as to not disrupt traffic) and have the daemon reattach to the containers?

uname -a:

Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

docker info:

docker info:

Containers: 23
 Running: 2
 Paused: 0
 Stopped: 21
Images: 16
Server Version: 1.11.1
Storage Driver: devicemapper
 Pool Name: docker-253:0-1567975-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 3.738 GB
 Data Space Total: 107.4 GB
 Data Space Available: 28 GB
 Metadata Space Used: 7.688 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.14 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.107-RHEL7 (2015-10-14)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: null host bridge
Kernel Version: 3.10.0-327.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 7.64 GiB
Name: 
ID: 
Docker Root Dir: /var/lib/docker
Debug mode (client): false
Debug mode (server): false
Username: 
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled


推荐答案

类似的东西将在1.12中解决:

Looks like this is something that will be addressed in 1.12:

https://github.com/docker/docker/issues/2658

这篇关于Docker守护程序重新启动并重新附加到容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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