關於docker 意外中止,從新快速啓動措施

1. 咱們要重啓這個鏡像,須要知道這個鏡像ID,相似這個:linux

7079ff99e10ac326726a364348853c0e508cad8ce00ae970f3c800f172a40252

那麼你能夠跳過下面的這個步驟:docker

  1. 咱們先找到docker 的存放位置,默認的docker 鏡像防止在/var/lib/docekr 位置,可是通常來講var的目錄比較小,若是咱們存的image鏡像比較大的話,可能須要修改默認存儲地址,這個在這裏不講.  咱們採用 sudo docker info 來查詢json

sudo docker info
➜  ~ docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 1
Server Version: 17.09.1-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan 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: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952GiB
Name: moby
ID: 7BAB:WVQS:GYQ2:47HA:IWJ4:G5NR:ZEYE:GVBW:BHNJ:WQE7:SNSJ:7FMM
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 18
 Goroutines: 29
 System Time: 2018-05-08T01:48:46.3659886Z
 EventsListeners: 1
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

咱們沒有發現bash

Docker Root Dir: dom

這個字段,因此說明目錄存儲在/var/lib/docker 目錄下,因此咱們直接在這個目錄下去尋找就能夠了.spa

咱們這裏是由於修改了docker的默認的存儲路徑:3d

[root@localhost ~]# sudo docker info
Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 1
Server Version: 1.13.1
Storage Driver: overlay
 Backing Filesystem: extfs
 Supports d_type: true
Logging Driver: journald
Cgroup Driver: systemd
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: docker-runc runc
Default Runtime: docker-runc
Init Binary: docker-init
containerd version:  (expected: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1)
runc version: N/A (expected: 9df8b306d01f59d3a8029be411de015b7304dd8f)
init version: N/A (expected: 949e6facb77383876aeff8a6944dde66b3089574)
Security Options:
 seccomp
  WARNING: You're not using the default seccomp profile
  Profile: /etc/docker/seccomp.json
Kernel Version: 3.10.0-229.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 3
CPUs: 32
Total Memory: 31.11 GiB
Name: localhost.localdomain
ID: LONA:BCUD:HM76:FIDU:NRJZ:ZYBC:E6F2:NMEG:6KIN:KBME:7EYL:J5EZ
Docker Root Dir: /data1/docker Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Registries: docker.io (secure)

因此這裏去/data1/docker下面尋找:code

[root@localhost ~]# ls /data1/docker/containersserver

7079ff99e10ac326726a364348853c0e508cad8ce00ae970f3c800f172a40252blog

[root@localhost ~]# 

而後咱們使用這個重啓:

首先,查看咱們的容器信息:

sudo docker inspect  7079ff99e10ac326726a364348853c0e508cad8ce00ae970f3c800f172a40252

啓動你的容器

sudo docker start 7079ff99e10ac326726a364348853c0e508cad8ce00ae970f3c800f172a40252

 

而後使用sudo docker ps  查看容器狀態:

[root@localhost ~]# docker ps
CONTAINER ID        IMAGE                                  COMMAND                  CREATED             STATUS              PORTS               NAMES
7079ff99e10a        xxxxxxx.xxx.xxx   "/usr/sbin/entrypo..."   2 weeks ago         Up 28 minutes                           elated_ramanujan

 

 

這樣咱們的容器就恢復了. 而後咱們進入容器,去重啓應用服務吧.

[root@localhost ~]# sudo docker exec  -it  7079ff99e10a  bash

而後就去恢復應用吧.

      

 

          ---- 完 ----

相關文章
相關標籤/搜索