発端
docker psを実行すると、コンテナが一つしか立ち上がっていないことになっていた。
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
337e0a77a3c3 portainer/portainer-ce "/portainer" 6 days ago Up About a minute 8000/tcp, 9443/tcp, 0.0.0.0:9999->9000/tcp, :::9999->9000/tcp portainer1
しかし、portainerで覗いてみると、4つコンテナが立ち上がっている。
これは、何が起こっているのか分からなかったので調べてみた。
dockerって2つ立ち上がることあるんか?
chatGPTさんに、聞いてみると、下記コマンドで調べられるよとのこと。
ps aux | grep dockerd
root 1266 1.6 1.0 2058888 84864 ? Ssl 08:27 0:04 dockerd --group docker --exec-root=/run/snap.docker --data-root=/var/snap/docker/common/var-lib-docker --pidfile=/run/snap.docker/docker.pid --config-file=/var/snap/docker/2915/config/daemon.json
root 1390 0.3 1.1 2209316 89984 ? Ssl 08:27 0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
******+ 4005 0.0 0.0 4724 2304 pts/0 S+ 08:31 0:00 grep --color=auto dockerd
docker info
Client: Docker Engine - Community
Version: 26.1.2
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.14.0
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.27.0
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 4
Running: 4
Paused: 0
Stopped: 0
Images: 6
Server Version: 24.0.5
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
runc version:
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.8.0-31-generic
Operating System: Ubuntu Core 22
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.676GiB
Name: marubishi-OptiPlex-3020
ID: 1ef2e372-a39a-45bf-9ae6-97ddc3285851
Docker Root Dir: /var/snap/docker/common/var-lib-docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
どうも下記2つが立ち上がっている模様。
snap版と通常版が入っているということらしい。
(そもそも2つ入るんか。。。。)
root 1266 1.6 1.0 2058888 84864 ? Ssl 08:27 0:04 dockerd --group docker --exec-root=/run/snap.docker --data-root=/var/snap/docker/common/var-lib-docker --pidfile=/run/snap.docker/docker.pid --config-file=/var/snap/docker/2915/config/daemon.json
root 1390 0.3 1.1 2209316 89984 ? Ssl 08:27 0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
snap版の開始と停止
sudo snap stop docker
sudo snap start docker
通常版の開始と停止
sudo systemctl stop docker
sudo systemctl start docker
そもそもdocker psはどちらを優先しているの?
以下、コマンドで確認出来る模様。
docker info
Client: Docker Engine - Community
Version: 26.1.2
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.14.0
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.27.0
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 4
Running: 4
Paused: 0
Stopped: 0
Images: 6
Server Version: 24.0.5
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
runc version:
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.8.0-31-generic
Operating System: Ubuntu Core 22
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.676GiB
Name: marubishi-OptiPlex-3020
ID: 1ef2e372-a39a-45bf-9ae6-97ddc3285851
Docker Root Dir: /var/snap/docker/common/var-lib-docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
現在の環境ではSnap版のDockerデーモンが優先されているみたい。
※もっと色々と書こうと思ったけど、トラブルシュート優先な為ここまで^^