LoginSignup
0
1

More than 3 years have passed since last update.

【Docker】コマンド一発で Jupyter 環境をつくる 🪐 【Anaconda】

Last updated at Posted at 2020-07-19

Dockerfile をつくる

touch Dockerfile
FROM ubuntu
RUN apt-get -y update && \
    apt-get install -y \
        sudo \
        wget \
        vim
WORKDIR /opt
RUN wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh && \
    sh /opt/Anaconda3-2020.02-Linux-x86_64.sh -b -p /opt/anaconda3 && \
    rm -f Anaconda3-2020.02-Linux-x86_64.sh
ENV PATH /opt/anaconda3/bin:$PATH
RUN pip install --upgrade pip
WORKDIR /
RUN mkdir /code
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--allow-root", "--LabApp.token=''"]

docker build する

docker build . -t jupyter

完了するまで 5 分くらいかかるかも

docker run する

ファイルを保存したいディレクトリに移動してから以下を実行

docker run -p 8888:8888 -v $(pwd):/code --name jupyter jupyter 

ブラウザで Jupyter にアクセス

ブラウザで http://localhost:8888 にアクセス

こんな画面になれば OK

screenshot-localhost_8888-2020.07.19-14_49_08.png

/code ディレクトリに作成したファイルはホストにも保存されます。

参考記事

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