[root@liuawen local]# docker -v
Docker version 1.13.1, build cccb291/1.13.1
[root@liuawen local]#
啓動、關閉與重啓docker時
[root@liuawen ~]# service docker stop
Redirecting to /bin/systemctl stop docker.service
[root@liuawen ~]# service docker start
Redirecting to /bin/systemctl start docker.service
[root@liuawen ~]# service docker restart
Redirecting to /bin/systemctl restart docker.service
[root@liuawen ~]#
出現這個Redirecting to /bin/systemctl start docker.service。
https://docs.docker.com/config/daemon/systemd/
大多數Linux發行版本使用systemctl
啓動服務,如果不是那就嘗試使用下service
來啓動。
我的環境是使用這個systemctl start docker
來啓動。
查看下ps -ef | grep "docker"
docker啓動了
啓動docker:systemctl start docker
停止docker:systemctl stop docker
重啓docker:systemctl restart docker
[root@liuawen local]# systemctl start docker
[root@liuawen local]# ps -ef | grep "docker"
root 25171 1 0 11:14 ? 00:00:00 /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 --selinux-enabled --log-driver=journald --signature-verification=false --storage-driver overlay2
root 25177 25171 0 11:14 ? 00:00:00 /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/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc --runtime-args --systemd-cgroup=true
root 25887 21199 0 11:24 pts/2 00:00:00 grep --color=auto docker
[root@liuawen local]# systemctl stop docker
[root@liuawen local]# ps -ef | grep "docker"
root 25910 21199 0 11:24 pts/2 00:00:00 grep --color=auto docker
[root@liuawen local]# systemctl restart docker
[root@liuawen local]# ps -ef | grep "docker"
root 25960 1 2 11:24 ? 00:00:00 /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 --selinux-enabled --log-driver=journald --signature-verification=false --storage-driver overlay2
root 25966 25960 0 11:24 ? 00:00:00 /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/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc --runtime-args --systemd-cgroup=true
root 26063 21199 0 11:25 pts/2 00:00:00 grep --color=auto docker
[root@liuawen local]#
使用systemctl 來啓動、停止、重啓docker都可以了。