0

It's my first week working on dockers, i have arrived on my new work, found running container on server, on this container i have installed jupyter. ps: i don't know on which port my container is running, there is no expose in the code.

I'm unable to access the jupyter from my localhost.

I did:

#Acess server
ssh data_team@word-server-prod
# on server
docker ps
f04ccccccc7        registry.gitlab.com/world/jupyter_project:9ad9XXXXXXXXXXXXXXXXXXXXXXXXXXX8   "/bin/bash -c '/usr/"   12 weeks ago         Up 12 weeks                                    jupyter_project
#  
# access to container
docker container exec -it f04ccccccc7 bash
#inside container
jupyter notebook --ip 0.0.0.0 --no-browser --allow-root
**i got**
http://127.0.0.1:8889/?token=16125997dXXXXXXXXXXXXXXXXXXXXXXXXXX24cd5d99
**from server i did**
curl http://127.0.0.1:8889/?token=16125997dXXXXXXXXXXXXXXXXXXXXXXXXXX24cd5d99

and i got curl: (7) Failed to connect to 127.0.0.1 port 8889: refused connexion

Jappa
  • 101
  • 8
  • How did you create the docker container? If you need to access a specific port on a container you need to share that port when running the container (using `-p 8889:8889`) – Matteo Zanoni Jun 10 '21 at 13:03
  • im not the person who created the containers ! the code is **variables: SERVER: word-server-prod SSH_OPTS: -p 22 -l data_team -o BatchMode=true -o StrictHostKeyChecking=no - ssh $SSH_OPTS -i $HOME/.ssh/id_rsa $SERVER "docker run -v /var/run/docker.sock:/var/run/docker.sock -v /etc/localtime:/etc/localtime -d --name jupyter_project $CI_IMAGE_COMMIT_TAG /bin/bash -c '/usr/sbin/cron -f -L 15'"** – Jappa Jun 10 '21 at 13:06
  • I believe this is your problem then. The container is not publishing the port 8889 so you will not be able to access it outside the container. – Matteo Zanoni Jun 10 '21 at 13:11
  • Thank you! ok, how can i publish this port on running container please? @MatteoZanoni – Jappa Jun 10 '21 at 13:12
  • just add `-p 8889:8889` to your docker run command – Matteo Zanoni Jun 10 '21 at 13:13
  • like this i should do a Merge, push on git etc (change file in the project)... Is there a solution to do it directly on running container please?. @MatteoZanoni – Jappa Jun 10 '21 at 13:16
  • I would not suggest doing it (and I have always avoided changing running container) but it looks like it is something doable. Try investigating this: https://stackoverflow.com/questions/19335444/how-do-i-assign-a-port-mapping-to-an-existing-docker-container – Matteo Zanoni Jun 10 '21 at 13:22

0 Answers0