Docker守护程序重新启动并重新连接到容器

时间:2016-05-23 15:19:15

标签: docker centos docker-compose

如果我终止了我的docker守护程序进程然后重新启动它,那么任何正在运行的容器现在都会以 Exited 状态列出,并且无法使用docker-compose重新启动,因为它已经会抱怨容器名称正在使用中。

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

有没有办法重新启动docker守护进程,让容器保持运行(以便不中断流量)并让守护进程重新连接到容器?

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

码头信息:

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 个答案:

答案 0 :(得分:0)

看起来这是将在1.12中解决的问题:

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