简体   繁体   中英

opening Jupyter Lab in docker container

recently started using docker and tried to crate a container with jupyter lab, so it could run on a local host.

Since I have been using anaconda before it seems like that localhost:8888 is already taken, so I have tried to use another avaliable port. `docker run -p 8080:8080 <image_name>' created a link which web page with token authentification which gives me no chance to enter. Also it used same port 8888. Is there any other port to use so that both, anaconda and docker work together without errors?

Have you tried this?

TL;DR:

Run docker as

docker run -it -p 8888:8888 image:version

Then, inside your container, initialize Jupyter with:

jupyter notebook --ip 0.0.0.0 --no-browser --allow-root

Now you are supposedly able to access the notebook through your desktop browser on http://localhost:8888

The -p option to docker run takes two ports. First is the port on the host that you want to connect to, and second is the port within the container that the service is running on.

Assuming jupyter is running on port 8888 inside the container, and you want to access it on 8080 on your localhost, the command you are looking for would be:

docker run -p 8080:8888 <image_name>

or to run it interactively and clean up after itself:

docker run -it --rm 8080:8888 <image_name>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM