我的linux操作系统是CentOS 7.3 64位,安装完docker之后,执行systemctl start docker启动docker报Unknown operation 'start docker'错误
于是我用systemctl start docker.service命令就能正常启动docker。
我用systemctl stop docker也是同样报Unknown operation"stop docker",后面改用service docker stop就能正常关闭docker了.
可能和linux操作系统版本有关,版本不一样,启停docker的命令也不一样。
[root@VM_0_5_centos ~]# docker -v
Docker version 19.03.13, build 4484c46d9d
[root@VM_0_5_centos ~]# systemctl start docker
Unknown operation 'start docker'.
[root@VM_0_5_centos ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: https://docs.docker.com
[root@VM_0_5_centos ~]# systemctl start docker.service
[root@VM_0_5_centos ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2020-11-17 21:11:33 CST; 5s ago
Docs: https://docs.docker.com
Main PID: 28955 (dockerd)
Tasks: 8
Memory: 133.8M
CGroup: /system.slice/docker.service
└─28955 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Nov 17 21:11:32 VM_0_5_centos dockerd[28955]: time="2020-11-17T21:11:32.754926664+08:00" level=info msg="ccResolverWrapper: sending updat...ule=grpc
Nov 17 21:11:32 VM_0_5_centos dockerd[28955]: time="2020-11-17T21:11:32.754937675+08:00" level=info msg="ClientConn switching balancer to...ule=grpc
Nov 17 21:11:32 VM_0_5_centos dockerd[28955]: time="2020-11-17T21:11:32.834383336+08:00" level=info msg="Loading containers: start."
Nov 17 21:11:33 VM_0_5_centos dockerd[28955]: time="2020-11-17T21:11:33.120521974+08:00" level=info msg="Default bridge (docker0) is assi...address"
Nov 17 21:11:33 VM_0_5_centos dockerd[28955]: time="2020-11-17T21:11:33.192775030+08:00" level=info msg="Loading containers: done."
Nov 17 21:11:33 VM_0_5_centos dockerd[28955]: time="2020-11-17T21:11:33.343032145+08:00" level=warning msg="Not using native diff for ove...overlay2
Nov 17 21:11:33 VM_0_5_centos dockerd[28955]: time="2020-11-17T21:11:33.343328022+08:00" level=info msg="Docker daemon" commit=4484c46d9d...19.03.13
Nov 17 21:11:33 VM_0_5_centos dockerd[28955]: time="2020-11-17T21:11:33.343439652+08:00" level=info msg="Daemon has completed initialization"
Nov 17 21:11:33 VM_0_5_centos dockerd[28955]: time="2020-11-17T21:11:33.396800309+08:00" level=info msg="API listen on /var/run/docker.sock"
Nov 17 21:11:33 VM_0_5_centos systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.
[root@VM_0_5_centos ~]#
[root@VM_0_5_centos ~]# systemctl stop docker
Unknown operation 'stop docker'.
[root@VM_0_5_centos ~]#service docker stop
Redirecting to /bin/systemctl stop docker.service
[root@VM_0_5_centos ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: https://docs.docker.com
Nov 17 21:21:36 VM_0_5_centos dockerd[30557]: time="2020-11-17T21:21:36.366846546+08:00" level=info msg="Loading containers: done."
Nov 17 21:21:36 VM_0_5_centos dockerd[30557]: time="2020-11-17T21:21:36.374973388+08:00" level=warning msg="Not using native diff for ove...overlay2
Nov 17 21:21:36 VM_0_5_centos dockerd[30557]: time="2020-11-17T21:21:36.375178794+08:00" level=info msg="Docker daemon" commit=4484c46d9d...19.03.13
Nov 17 21:21:36 VM_0_5_centos dockerd[30557]: time="2020-11-17T21:21:36.375226894+08:00" level=info msg="Daemon has completed initialization"
Nov 17 21:21:36 VM_0_5_centos dockerd[30557]: time="2020-11-17T21:21:36.395310249+08:00" level=info msg="API listen on /var/run/docker.sock"
Nov 17 21:21:36 VM_0_5_centos systemd[1]: Started Docker Application Container Engine.
Nov 17 21:23:41 VM_0_5_centos systemd[1]: Stopping Docker Application Container Engine...
Nov 17 21:23:41 VM_0_5_centos dockerd[30557]: time="2020-11-17T21:23:41.628260672+08:00" level=info msg="Processing signal 'terminated'"
Nov 17 21:23:41 VM_0_5_centos dockerd[30557]: time="2020-11-17T21:23:41.628888302+08:00" level=info msg="Daemon shutdown complete"
Nov 17 21:23:41 VM_0_5_centos systemd[1]: Stopped Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.