Solution of Docker container can't be accessed by jupyter
- 2021-10-11 20:01:18
- OfStack
In this project, docker container is used to build the environment, and Dockerfile is as follows:
FROM tensorflow/tensorflow:1.14.0-gpu-py3
RUN pip install scipy==1.3.3
RUN pip install requests
RUN pip install Pillow
RUN pip install matplotlib
RUN pip install pandas
RUN pip install keras==2.2.4
RUN pip install scikit_learn==0.20.0
RUN pip install transformers==3.5.0
Create an docker container:
sudo docker build - < Dockerfile
Label after successful creation:
docker tag a7a1861d2150 datascience/text2animeface:v0.1
Then enter the container:
sudo docker run --gpus all -it -p 8080:8080 -p 8888:8888 -d -v `pwd`:/mnt datascience/text2animeface:v0.1
Then start jupyter after installing jupyter
jupyter-notebook --allow-root
There is a problem, localhost: 8888 can't be accessed from outside, and telnet can't be accessed. Try again and again, and you don't need to re-establish the container. You can start jupyter directly with the following command:
jupyter-notebook --allow-root --ip=0.0.0.0 --port=8888
The ip address is bound to 0.0. 0.0, which is any ip address, port 8888,