docker重新启动后,找不到原来的镜像和容器
2018-05-12 14:17:41
sun
  • 访问次数: 3
  • 注册日期: 2018-05-12
  • 最后登录: 2018-05-12

docker里面有一个容器不能正常启动了,配置后重启了docker服务,没响应。改了配置文件后docker服务能启动,但是里面的镜像和容器都找不到了,即运行docker ps  和dockerimages 为空。查看/var/lib/docker/containters里面的容器文件都在。

目前的配置如下:

vim  /etc/sysconfig/docker   内容:other_args="--graph=/var/lib/docker"

vim  /etc/docker/daemon.json 内容:{ "storage-driver": "devicemapper" }

vim  /etc/default/docker 内容为空

/etc/systemd/system/docker.service.d/docker.conf 文件不存在。

试验发现只要 vim  /etc/docker/daemon.json 中有这一行 { "storage-driver": "devicemapper" } 就能启动,去掉就不能启动,试着在 vim  /etc/sysconfig/docker中加上挂载目录 other_args="--graph=/var/lib/docker" ,执行docker ps仍是空。

docker info 输入如下:

Containers: 0

 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 18.03.0-ce
Storage Driver: devicemapper
 Pool Name: docker-253:4-134333542-pool
 Pool Blocksize: 65.54kB
 Base Device Size: 10.74GB
 Backing Filesystem: xfs
 Udev Sync Supported: true
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Data Space Used: 11.8MB
 Data Space Total: 107.4GB
 Data Space Available: 97.47GB
 Metadata Space Used: 581.6kB
 Metadata Space Total: 2.147GB
 Metadata Space Available: 2.147GB
 Thin Pool Minimum Free Space: 10.74GB
 Deferred Removal Enabled: true
 Deferred Deletion Enabled: true
 Deferred Deleted Device Count: 0
 Library Version: 1.02.140-RHEL7 (2017-05-03)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfd04396dc68220d1cecbe686a6cc3aa5ce3667c
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 3.10.0-693.21.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.44GiB
Name: kunlunweb
ID: EYG6:K3TU:U475:TBAA:E66O:DGYJ:XPEI:2SPB:RRGB:SXVQ:WQ6P:KOEU
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
WARNING: devicemapper: usage of loopback devices is strongly discouraged for production use.
         Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
不知道还能不能挂上我的那些容器?