1. Create Dockerfile to run Jupyternotebook.
FROM continuumio/miniconda3
WORKDIR /usr/app
RUN mkdir result
RUN mkdir src
EXPOSE 8888 #Allow to access to container port
RUN pip install --no-cache-dir --upgrade pip
COPY ./requirements.txt .
RUN pip install -r requirements.txt
RUN pip install jupyter
RUN jupyter notebook --generate-config --allow-root
ENTRYPOINT jupyter notebook --allow-root --ip=0.0.0.0 --port=8888 --no-browser #Execute jupyter notebook when start container
2. Docker build
$ docker build -t jupyter:1.0 .
3. Mount local directory with container using volume. DO NOT FORGET TO CONNECT PORT(I made mistake one time when I connect to jupyter, I didn't connect the port).
$ docker run -it --rm -p 8888:8888 --name jupyter -v /Users/joohyunyoon/Documents/Workspace/src:/usr/app/src jupyter:1.0
...
http://139c0b0ad9e7:8888/?token=fcc3dce70ca9d4c58c7ecb54f0dbbb0b10cc2d45a960dc9d
or http://127.0.0.1:8888/?token=fcc3dce70ca9d4c58c7ecb54f0dbbb0b10cc2d45a960dc9d
...
4. Access Jupyternotebook on the browser.
5. Access Jupyternotebook on VisualStuioCode and check the volume.
When code has change whether Jupyternotebook or VisualStuioCode, it interacts well.
- Jupyternotebook
- VisualStuioCode
'Docker' 카테고리의 다른 글
Docker error:You have to remove (or rename) that container to be able to reuse that name. (0) | 2021.11.23 |
---|---|
Docker Project 3-DockerCompose, Elasticsearch (0) | 2021.11.16 |
Docker Project 1-Docker environment, build, volume, logs (0) | 2021.11.08 |
Run container with environment variable (0) | 2021.11.02 |
How to run my python project on the docker (0) | 2021.10.22 |