Inconsistent ability to connect to Jupyter application running within a Docker container on a Ubuntu host in EC2

0

I have set up a Ubuntu server on EC2 running Docker with a container running JupyterHub. I am running the container with docker run -p 8888:8888 <container name>

After building the server, I can connect fine from a Windows AppStream instance's Chrome browser using http://<Ubuntu private IP>:8888

If I switch the Ubuntu server off then on/reboot. I can no longer connect to Jupyter after running the container again in the same way. I also cannot connect using Test-NetConnection from Powershell with the Ubuntu Private IP and port 8888.

I tried setting up a simple Python3 web server to serve a HTML file. This is accessible from Chrome on the Windows client before and after a Ubuntu reboot consistently, as long as I run the web server. SSH access from the Windows client is also consistent.

If I SSH onto the Ubuntu box after a Ubuntu reboot, it behaves consistently trying to interface with Jupyter as before a reboot:

  • curl http://localhost:8888 from the Ubuntu server returns blank output but the container shows a GET request
  • exec onto the container lets me interact with Jupyter.
1 Answer
0

It sounds like the Jupyter container might not be starting up properly after the Ubuntu server reboots. Here are a few things you can check:

  1. Check the container logs: After running the container, try running docker logs <container name> to see if there are any error messages that might indicate why Jupyter is not starting up properly.
  2. Check the Jupyter configuration: Make sure that the Jupyter configuration file is set up correctly, and that the correct IP address and port are specified. You can check the configuration file by exec'ing into the container and running jupyter notebook --generate-config.
  3. Check the firewall settings: It's possible that the firewall settings on the Ubuntu server are blocking incoming connections on port 8888. You can check the firewall settings by running sudo ufw status.
  4. Check the Docker network configuration: Make sure that the Docker network is set up correctly and that the container is attached to the correct network. You can check the Docker network settings by running docker network inspect <network name>.
  5. Try using a different port: It's possible that there is a conflict with another service running on port 8888. Try using a different port, like 8889, and see if you can connect to Jupyter on that port.

Hopefully one of these suggestions will help you diagnose the issue!

hash
answered a year ago
  • Hi there. Many thanks for your guidance. For each step I compared a fresh EC2 Ubuntu instance where Jupyter is still accessible from a remote client browser against an instance which has been rebooted and where Jupyter is no longer accessible from a remote client browser. Results of each step:

    1. The logs just show the typical output returned when Jupyter boots. The only material difference I could see was the functional instance loaded the nbdime package. Looking this up it does not seem related - other packages e.g. nbconvert were loaded by both instances.
    2. Jupyter config files match.
    3. ufw status disabled on both
    4. Docker network connection matches.
    5. Tried on 8889, and 8000, both running with docker run -p 8889:8888 and docker run -p 8889:8889, for example.
  • I wonder if there is a Docker or Ubuntu process/service that needs to be re-run after a server reboot? I have tried sudo service docker restart to no avail as well as restarting the container after running.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions