1
1

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.

kerasのdockerfile

Last updated at Posted at 2018-12-01

docker 使い方

環境構築が一瞬でできる。
docker imageというものを指定するとdocker imageで指定された環境ができる。

docker fileの書き方

dockerfile
#tensorflow のGPUイメージを取ってくる
FROM tensorflow/tensorflow:latest-gpu-py3 

LABEL maintainer="username" 

 RUN pip --no-cache-dir install \ 
         keras 

opencvを入れる場合はこちら

dockerfile
FROM tensorflow/tensorflow:latest-gpu-py3
LABEL maintainer="username"

RUN apt-get update && apt-get install -y --no-install-recommends \
        libsm6 \
        libxext6 \
        libgtk2.0-dev \
        language-pack-ja-base \
        language-pack-ja \
        libblas-dev \
        liblapack-dev \
        && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN pip --no-cache-dir install \
	torch torchvision \
	pydensecrf \
        opencv-python \
        imageio \
        scikit-image \ 
        keras \
        gputil \
        hyperdash \
        scipy \
        tqdm \
        jupyter_contrib_nbextensions \
        jupyter_nbextensions_configurator\
        pydot \
        staintools==0.1.1\
        pulp \
        tqdm

docker を動かしてみる

docker imageのビルド

bash
 docker build -t tesor-keras dockerfileの場所

dockerのコンテナを動かす

docker run オプション   ドッカーイメージの名前
docker run --runtime=nvidia --rm -it -p 8888:8888 --name root -v $(pwd):/workdir -w /workdir tensor-keras

--runtime=nvidia:GPUを使う場合使用,
--rm :stopしたときにコンテナも終了,
-p:ポートを8888で開放,
--name:コンテナの名前,
-v:現在のディレクトリを/workdirにマウント

表示されたurlに飛ぶとtensorflow-gpu+kerasが入った環境ができる!

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?