查看docker 状态
时间: 2023-07-26 20:28:16 浏览: 184
docker-monitoring
您可以使用以下命令来查看 Docker 的状态:
```
sudo systemctl status docker
```
该命令将显示 Docker 服务的运行状态以及任何相关的错误或警告信息。如果 Docker 服务正在运行,则输出应该类似于以下内容:
```
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-11-01 14:10:58 UTC; 2h 13min ago
Docs: https://docs.docker.com
Main PID: 1234 (dockerd)
Tasks: 12
Memory: 44.6M
CGroup: /system.slice/docker.service
├─1234 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
└─5678 containerd --config /var/run/containerd/containerd.toml --log-level info
Nov 01 14:10:58 ubuntu systemd[1]: Starting Docker Application Container Engine...
Nov 01 14:10:58 ubuntu dockerd[1234]: time="2021-11-01T14:10:58.506505900Z" level=info msg="Starting up"
Nov 01 14:10:58 ubuntu dockerd[1234]: time="2021-11-01T14:10:58.507224200Z" level=info msg="parsed scheme: \"unix\"" module=grpc
Nov 01 14:10:58 ubuntu dockerd[1234]: time="2021-11-01T14:10:58.507247100Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Nov 01 14:10:58 ubuntu dockerd[1234]: time="2021-11-01T14:10:58.507274500Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0 <nil>}] <nil>}" module=grpc
Nov 01 14:10:58 ubuntu dockerd[1234]: time="2021-11-01T14:10:58.507285400Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Nov 01 14:10:58 ubuntu dockerd[1234]: time="2021-11-01T14:10:58.508141400Z" level=info msg="parsed scheme: \"unix\"" module=grpc
Nov 01 14:10:58 ubuntu dockerd[1234]: time="2021-11-01T14:10:58.508159200Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Nov 01 14:10:58 ubuntu dockerd[1234]: time="2021-11-01T14:10:58.508180500Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0 <nil>}] <nil>}" module=grpc
Nov 01 14:10:58 ubuntu dockerd[1234]: time="2021-11-01T14:10:58.508191600Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
```
如果 Docker 服务未运行,则输出应该类似于以下内容:
```
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Mon 2021-11-01 12:54:17 UTC; 3h 30min ago
Docs: https://docs.docker.com
Process: 1234 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 1234 (code=exited, status=1/FAILURE)
```
阅读全文