tl;dr
docker: Error response from daemon: failed to create task for container: failed to create shim task: ttrpc: cannot marshal unknown type: *task.CreateTaskRequest: unknown.
ERRO[0005] error waiting for container:
デフォルトでLinuxにインストールされる(ディストリビュージョンrepoの)Dockerを使ってはいけない。Docker公式のrepoのものを手動インストールすべき。
経緯
Dockerでウェブページを動かしていたサーバーがぶっ壊れて、/home
と/srv
以外をすべて再インストールした後、Dockerアプリが立ち上がらなくなった。
以下環境。
- OS: Linux Fedora 39
- マシン:デスクトップ実機PC(仮想化等なし)
症状
$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
719385e32844: Pull complete
Digest: sha256:4f53e2564790c8e7856ec08e384732aa38dc43c52f02952483e3f003afbf23db
Status: Downloaded newer image for hello-world:latest
docker: Error response from daemon: failed to create task for container: failed to create shim task: ttrpc: cannot marshal unknown type: *task.CreateTaskRequest: unknown.
ERRO[0005] error waiting for container:
重症
いろいろなサイトで、/var/lib/docker
を削除してみろとか、パーミッションを変えてみろとか言われるも、ことごとく変化なし。
原因解明
どうやら、ディストリビュージョン公式repoのものを使ってはいけないらしい。
$ docker info
Client:
Version: 24.0.5
Context: default
Debug Mode: false
Server:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 1
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: journald
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: runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: /usr/libexec/docker/docker-init
containerd version:
runc version:
init version:
Security Options:
seccomp
Profile: builtin
selinux
cgroupns
Kernel Version: 6.5.5-300.fc39.x86_64
Operating System: Fedora Linux 39 (Workstation Edition Prerelease)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.03GiB
Name: fedora
ID: xxxxxxxxxxxxxxxxxxxxxxxx
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: true
このため、Docker公式verを再インストールする。
再インストール方法
まずDocker関連を消す。
$ sudo dnf remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
一致した引数がありません: docker-client
一致した引数がありません: docker-client-latest
一致した引数がありません: docker-common
一致した引数がありません: docker-latest-logrotate
一致した引数がありません: docker-logrotate
一致した引数がありません: docker-engine-selinux
一致した引数がありません: docker-engine
依存関係が解決しました。
================================================================================
パッケージ Arch バージョン リポジトリー サイズ
================================================================================
削除中:
container-selinux noarch 2:2.222.0-1.fc39 @updates-testing 67 k
moby-engine x86_64 24.0.5-1.fc39 @fedora 108 M
未使用の依存関係の削除:
containerd x86_64 1.6.23-1.fc39 @fedora 137 M
トランザクションの概要
================================================================================
削除 3 パッケージ
解放された容量: 245 M
これでよろしいですか? [y/N]: y
そして、関連してpodmanとbuildahが残っているとコンフリクトを起こすようなので、これも泣く泣く消す。(解決法があるのでしょうか?)
$ sudo dnf remove podman buildah
一致した引数がありません: buildah
依存関係が解決しました。
================================================================================
パッケージ Arch バージョン リポジトリー サイズ
================================================================================
削除中:
podman x86_64 5:4.7.0-1.fc39 @updates-testing 48 M
依存関係パッケージの削除:
toolbox x86_64 0.0.99.4-3.fc39 @fedora 7.3 M
未使用の依存関係の削除:
aardvark-dns x86_64 1.8.0-1.fc39 @updates-testing 2.3 M
catatonit x86_64 0.1.7-18.fc39 @fedora 1.1 M
conmon x86_64 2:2.1.8-2.fc39 @updates-testing 325 k
containers-common noarch 4:1-95.fc39 @fedora 120 k
containers-common-extra noarch 4:1-95.fc39 @fedora 0
criu x86_64 3.18-3.fc39 @fedora 1.5 M
criu-libs x86_64 3.18-3.fc39 @fedora 85 k
crun x86_64 1.9.2-1.fc39 @updates-testing 484 k
fuse-overlayfs x86_64 1.12-2.fc39 @fedora 131 k
gvisor-tap-vsock x86_64 6:0.7.0-6.fc39 @fedora 12 M
gvisor-tap-vsock-gvforwarder x86_64 6:0.7.0-6.fc39 @fedora 5.7 M
libbsd x86_64 0.11.7-5.fc39 @fedora 374 k
libmd x86_64 1.1.0-2.fc39 @fedora 107 k
libnet x86_64 1.2-9.fc39 @fedora 124 k
netavark x86_64 1.8.0-2.fc39 @updates-testing 9.8 M
qemu-user-static x86_64 2:8.1.1-1.fc39 @updates-testing 45 k
qemu-user-static-aarch64 x86_64 2:8.1.1-1.fc39 @updates-testing 12 M
qemu-user-static-alpha x86_64 2:8.1.1-1.fc39 @updates-testing 3.3 M
qemu-user-static-arm x86_64 2:8.1.1-1.fc39 @updates-testing 8.7 M
qemu-user-static-cris x86_64 2:8.1.1-1.fc39 @updates-testing 3.3 M
qemu-user-static-hexagon x86_64 2:8.1.1-1.fc39 @updates-testing 5.5 M
qemu-user-static-hppa x86_64 2:8.1.1-1.fc39 @updates-testing 3.4 M
qemu-user-static-loongarch64 x86_64 2:8.1.1-1.fc39 @updates-testing 3.6 M
qemu-user-static-m68k x86_64 2:8.1.1-1.fc39 @updates-testing 3.6 M
qemu-user-static-microblaze x86_64 2:8.1.1-1.fc39 @updates-testing 6.7 M
qemu-user-static-mips x86_64 2:8.1.1-1.fc39 @updates-testing 26 M
qemu-user-static-nios2 x86_64 2:8.1.1-1.fc39 @updates-testing 3.3 M
qemu-user-static-or1k x86_64 2:8.1.1-1.fc39 @updates-testing 3.3 M
qemu-user-static-ppc x86_64 2:8.1.1-1.fc39 @updates-testing 13 M
qemu-user-static-riscv x86_64 2:8.1.1-1.fc39 @updates-testing 8.8 M
qemu-user-static-s390x x86_64 2:8.1.1-1.fc39 @updates-testing 3.7 M
qemu-user-static-sh4 x86_64 2:8.1.1-1.fc39 @updates-testing 6.7 M
qemu-user-static-sparc x86_64 2:8.1.1-1.fc39 @updates-testing 10 M
qemu-user-static-x86 x86_64 2:8.1.1-1.fc39 @updates-testing 7.9 M
qemu-user-static-xtensa x86_64 2:8.1.1-1.fc39 @updates-testing 13 M
runc x86_64 2:1.1.8-1.fc39 @fedora 10 M
shadow-utils-subid x86_64 2:4.14.0-1.fc39 @fedora 58 k
slirp4netns x86_64 1.2.1-1.fc39 @fedora 93 k
トランザクションの概要
================================================================================
削除 40 パッケージ
解放された容量: 246 M
これでよろしいですか? [y/N]: y
そして再インストール。
ここの指示に従う。
で、今回使っているFedora 39はまだベータ版であり、まだDockerのリリースが出ていなかったので、
のcontainerd.io
と、
のdocker-ce
, docker-ce-cli
, docker-compose
, docker-ce-rootless
をインストールすれば良い。
まず、マニュアルどおりでいけるものを入れる。
$ sudo dnf config-manager \
--add-repo \
https://download.docker.com/linux/fedora/docker-ce.repo
repo の追加: https://download.docker.com/linux/fedora/docker-ce.repo
$ sudo dnf install containerd.io
依存関係が解決しました。
=========================================================================================================================================
パッケージ アーキテクチャー バージョン リポジトリー サイズ
=========================================================================================================================================
インストール:
containerd.io x86_64 1.6.24-3.1.fc39 docker-ce-stable 33 M
依存関係のインストール:
container-selinux noarch 2:2.222.0-1.fc39 updates-testing 55 k
トランザクションの概要
=========================================================================================================================================
インストール 2 パッケージ
ダウンロードサイズの合計: 33 M
インストール後のサイズ: 115 M
これでよろしいですか? [y/N]: y
そして、手動で残りのものを
からダウンロードして、インストールする。
$ sudo dnf install '/home/xxxx/ダウンロード/docker-ce-rootless-extras-24.0.6-1.fc38.x86_64.rpm' '/home/xxxx/ダウンロード/docker-compose-plugin-2.21.0-1.fc38.x86_64.rpm' '/home/xxxx/ダウンロード/docker-ce-cli-24.0.6-1.fc38.x86_64.rpm' '/home/xxxx/ダウンロード/docker-ce-24.0.6-1.fc38.x86_64.rpm'
依存関係が解決しました。
=========================================================================================================================================
パッケージ アーキテクチャー バージョン リポジトリー サイズ
=========================================================================================================================================
インストール:
docker-ce x86_64 3:24.0.6-1.fc38 @commandline 24 M
docker-ce-cli x86_64 1:24.0.6-1.fc38 @commandline 7.1 M
docker-ce-rootless-extras x86_64 24.0.6-1.fc38 @commandline 3.9 M
docker-compose-plugin x86_64 2.21.0-1.fc38 @commandline 13 M
依存関係のインストール: container-selinux noarch 2:2.222.0-1.fc39 updates-testing 55 k
fuse-overlayfs x86_64 1.12-2.fc39 fedora 67 k
libcgroup x86_64 3.0-3.fc39 fedora 74 k
slirp4netns x86_64 1.2.1-1.fc39 fedora 47 k
トランザクションの概要
=========================================================================================================================================
インストール 7 パッケージ
合計サイズ: 48 M
ダウンロードサイズの合計: 189 k
インストール後のサイズ: 194 M
これでよろしいですか? [y/N]: y
完了
これで正常に動作した。
$ docker info
Client: Docker Engine - Community
Version: 24.0.6
Context: default
Debug Mode: false
Plugins:
compose: Docker Compose (Docker Inc.)
Version: v2.21.0
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 6
Running: 3
Paused: 0
Stopped: 3
Images: 11
Server Version: 24.0.6
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: 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
runc version: v1.1.9-0-gccaecfc
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.5.5-300.fc39.x86_64
Operating System: Fedora Linux 39 (Workstation Edition Prerelease)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.03GiB
Name: fedora
ID: xxxxxxxxxxxxxxxxxxxxxxxxxxx
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
きちんと動く。
$ sudo docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
結論:ディストリ公式repoを常に信用してはいけない
それってどうなの?