前提:構成
- Windows10
- WSL2 カーネルバージョン 5.10.102.1
- Ubuntu 22.04 LTS ※アップグレード前は「Ubuntu 20.04.4 LTS」
- docker-ce 20.10.14 ※docker desktopは未使用
前提:アップグレードでやったこと
sudo apt update && sudo apt upgrade
sudo apt dist-upgrade && sudo apt install update-manager-core
sudo do-release-upgrade -d
dockerが起動しない
$ sudo /etc/init.d/docker start
* Starting Docker: docker [ OK ]
$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
$
docker起動時のエラーメッセージ
failed to start daemon: Error initializing network controller: error obtaining controller instance: unable to add return rule in DOCKER-ISOLATION-STAGE-1 chain: (iptables failed: iptables --wait -A DOCKER-ISOLATION-STAGE-1 -j RETURN: iptables v1.8.7 (nf_tables): RULE_APPEND failed (No such file or directory): rule in chain DOCKER-ISOLATION-STAGE-1 (exit status 4))
エラー内容にiptablesとあったのでlegacyにしてみる
$ sudo update-alternatives --config iptables
alternative iptables (/usr/sbin/iptables を提供) には 2 個の選択肢があります。
選択肢 パス 優先度 状態
------------------------------------------------------------
* 0 /usr/sbin/iptables-nft 20 自動モード
1 /usr/sbin/iptables-legacy 10 手動モード
2 /usr/sbin/iptables-nft 20 手動モード
現在の選択 [*] を保持するには <Enter>、さもなければ選択肢の番号のキーを押してください: 1
update-alternatives: /usr/sbin/iptables (iptables) を提供するためにマニュアルモードで /usr/sbin/iptables-legacy を使います
$
無事起動できました
$ sudo /etc/init.d/docker start
* Starting Docker: docker [ OK ]
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:10d7d58d5ebd2a652f4d93fdd86da8f265f5318c6a73cc5b6a9798ff6d2b2e67
Status: Downloaded newer image for hello-world:latest
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/