LoginSignup
2
0

More than 5 years have passed since last update.

Windows 10 + Ubuntu 16.04.4 LTS + Docker + TensorFlow

Last updated at Posted at 2018-07-10

概要

WSLでDockerが動くようになったので。

legacy WSLのアンインストール

Dockerが動くのはstore版のWSLだけです。
legacy WSLがインストールされている場合は、いったんアプリと機能からアンインストールしてください。

Ubuntuのインストール

Microsoft Storeからインストールします。

Dockerのインストール

管理者権限でWSLを起動し、Dockerをインストールします。

sudo apt -y update
sudo apt -y upgrade
sudo apt -y install docker.io
sudo cgroupfs-mount
sudo usermod -aG docker $USER
sudo service docker start

ここでサービスの起動は失敗しているので、いったんWSLを再起動します。
再起動後、あらためてステータスを確認すると、

$ sudo service docker status
[sudo] password for XXXXXX:
 * Docker is running

無事動作しています。
続けてdocker run hello-worldが動作するはずです。

$ docker run --rm hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9bb5a5d4561a: Pull complete
Digest: sha256:3e1764d0f546ceac4565547df2ac4907fe46f007ea229fd7ef2718514bcec35d
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.
...

お待ちかね、TensorFlowのDockerイメージを起動します。

$ docker run -it -p 8888:8888 tensorflow/tensorflow:latest-py3
...
    to login with a token:
        http://localhost:8888/?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

ここで、ブラウザへ移動し、指定されたtokenでjupyter notebookを起動します。

最後に、TensorFlowでHello worldできたらインストール成功です。

import tensorflow as tf

hello = tf.constant('Hello, TensorFlow!')
print(sess.run(hello))
Hello, TensorFlow!

お疲れさまでした。

2
0
0

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
2
0