25 views

To check Docker service

To check Docker service status in CentOS 7 or in RHEL 7, use systemctl status command:

/bin/systemctl status docker.service

Typical output, if docker service is running:

[root@aws-centos7 ~]# /bin/systemctl status docker.service
   docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 20XX-08-10 16:27:39 UTC; 8s ago
     Docs: http://docs.docker.com
 Main PID: 1116 (dockerd-current)
   CGroup: /system.slice/docker.service
           ├─1116 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --use...
           └─1121 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker...

Aug 10 16:27:38 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:27:38.746817573Z" level=warning msg="Docker could not enable SELinux on the host system"
Aug 10 16:27:38 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:27:38.763542673Z" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Aug 10 16:27:38 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:27:38.763973016Z" level=info msg="Loading containers: start."
Aug 10 16:27:38 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:27:38.817524044Z" level=info msg="Firewalld running: false"
Aug 10 16:27:38 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:27:38.937361342Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/...IP address"
Aug 10 16:27:38 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:27:38.962074658Z" level=info msg="Loading containers: done."
Aug 10 16:27:38 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:27:38.987259776Z" level=info msg="Daemon has completed initialization"
Aug 10 16:27:38 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:27:38.987289231Z" level=info msg="Docker daemon" commit="b2f74b2/1.13.1" graphdriver=overlay2 version=1.13.1
Aug 10 16:27:39 aws-centos7 systemd[1]: Started Docker Application Container Engine.
Aug 10 16:27:39 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:27:39.003607308Z" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.

Typical output, if docker service is not running:

It is a little bit verbose, look at the lines:

Active: inactive (dead) since Sat 20XX-08-10 16:33:37 UTC; 28s ago

and

systemd[1]: Stopped Docker Application Container Engine.

This is telling us that docker is in stopped state

[root@aws-centos7 ~]# /bin/systemctl status docker.service
   docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: inactive (dead) since Sat 20XX-08-10 16:33:37 UTC; 28s ago
     Docs: http://docs.docker.com
  Process: 1116 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=0/SUCCESS)
 Main PID: 1116 (code=exited, status=0/SUCCESS)

Aug 10 16:27:38 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:27:38.962074658Z" level=info msg="Loading containers: done."
Aug 10 16:27:38 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:27:38.987259776Z" level=info msg="Daemon has completed initialization"
Aug 10 16:27:38 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:27:38.987289231Z" level=info msg="Docker daemon" commit="b2f74b2/1.13.1" graphdriver=overlay2 version=1.13.1
Aug 10 16:27:39 aws-centos7 systemd[1]: Started Docker Application Container Engine.
Aug 10 16:27:39 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:27:39.003607308Z" level=info msg="API listen on /var/run/docker.sock"
Aug 10 16:33:36 aws-centos7 systemd[1]: Stopping Docker Application Container Engine...
Aug 10 16:33:36 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:33:36.105341064Z" level=info msg="Processing signal 'terminated'"
Aug 10 16:33:36 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:33:36.10659655Z" level=info msg="stopping containerd after receiving terminated"
Aug 10 16:33:36 aws-centos7 dockerd-current[1116]: time="20XX-08-10T16:33:36.106681752Z" level=fatal msg="containerd: serve grpc" error="accept unix /var/run/docker/libcont...connection"
Aug 10 16:33:37 aws-centos7 systemd[1]: Stopped Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.
[root@aws-centos7 ~]#

To Stop Docker service:

systemctl stop docker.service

To Start Docker service

systemctl start docker.service
Nov 29, 2018 by | 25 views
Articles for DevOps Geeks
MobaXterm Customization
CHMOD Explained!
Bash history powerful tips
Ubuntu bash from Windows
..