3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ubuntu(WSL)でDockerが使えなかった問題への対処

Last updated at Posted at 2018-09-17

問題点

Windows上のUbuntu 18.04(WSL)上でDockerが使えない。
$ sudo service docker start
しても、直ぐにdocker daemonが終了してしまう。

具体的なエラーメッセージ

/var/log/docker.logを見てみると

Error starting daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: iptables v1.6.1: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
(exit status 3)

iptablesもしくはカーネルのバージョンを上げろと?

試してダメだったこと

$ sudo apt update
$ sudo apt upgrade iptables

言われるままにiptablesのバージョンを上げてみたが、エラーメッセージは変わらず。

解決策

結論としては、Ubuntuの18.04を使うのをあきらめて、16.04を入れ直したところ、使えるようになった。
http://www.nuits.jp/entry/docker-on-wsl
↑ こちらに大変お世話になった。

$ sudo apt update
$ sudo apt upgrade -y
$ sudo apt install -y docker.io
$ sudo cgroupfs-mount

ここまでやり直して、
$ su - (ローカルユーザー名)
してから

$ sudo usermod -aG docker $USER
$ sudo service docker start

再起動。
管理者で!WSL起動で、ようやく行けた。
$ sudo cgroupfs-mount && sudo service docker start
管理者起動 & cgroupfs-mountが要るらしい。

Nakamuraさん、ありがとうございます!

3
4
5

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?