skip to Main Content

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?

2

Answers


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

    Login or Signup to reply.
  2. 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>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search