Run Jupyter Lab inside a container

I have a lot of containers operating for different services. Since I use Jupyter a lot for school, I’ve decided to build a container for it. Thus, I decided to use a OpenVPN container of my.
The main idea was to connect using VPN and can access Jupyter notebook with tun IP address. The problem is that I can’t access it either way.

Can connect using tun ip:, LAN ip: or LXC IP:

I’ve tried nmap and I get all ports closed.

Just follow this GitHub to build my OpenVPN

$ lxc exec openvpn bash
jupyter-l 564 thales    4u  IPv4 108605      0t0  TCP (LISTEN)

Hi Thales!

Using Jupyter in a LXD container should be quite easy. Here is a tutorial on getting Julia on Jupyter in a LXD container,

The part that I do not understand is why would you need to setup OpenVPN in the container. If you are using a local installation of Jupyter on your desktop/laptop, then you can access easily using a proxy device. See my post above on how to do that. On the other hand, if the installation of Jupyter is at your school, then this is an OpenVPN question on how to setup OpenVPN in a container.

Hello Simos, I want to access it using my iPad, so I need to build a server for it. However, I also need a VPN connection for it. Thats why I’m building it inside the same container. My problem is really specific. I have my Jupiter server running, but I can’t access it.
Maybe there is some filter for my ports and I’m afraid to try and do something wrong with my VPN.

At my tutorial, I explain that Jupyter by default listens on localhost.
Shall I assume that you have looked into that?

edit: Documentation at Jupyter on this,

Sorry, shame on me! I’ve carefully read the document. It’s very good by the way. However, I can’t connect connect using tun ip (

Using the line bellow:

$ lxc config device add julia port8888 proxy listen=tcp: connect=tcp:localhost:8888

and at the host

sudo iptables -t nat -A PREROUTING -p tcp -i enp2s0 --dport 8888 -j DNAT --to-destination

I could connect.

With that I can access using the host IP only.

I’m still confusing. Help me please.

To access the Jupyter installation remotely from an OpenVPN connection, you would need to look into OpenVPN routing. See for example,

At a later point I would suggest to run OpenVPN and Jupyter in separate containers.

I see. So it is better to build another machine for jupyter and access it using host ip? I will follow your suggestion.

One last question. I have a Nextcloud server. Is there a way to integrate it? Like Collabora Office?

EDIT: I’ve created another container.

$ lxc list
|    NOME     | ESTADO  |         IPV4         | IPV6 |    TIPO     | SNAPSHOTS |
| jupyter     | RUNNING | (eth0) |      | PERSISTENTE | 0         |
| openproject | RUNNING | (eth0)  |      | PERSISTENTE | 0         |
| openvpn     | RUNNING | (tun0)      |      | PERSISTENTE | 0         |
|             |         | (eth0)  |      |             |           |
| telegrambot | STOPPED |                      |      | PERSISTENTE | 0         |

I setup a service to start jupyter-lab during boot:

$ cat /etc/systemd/system/jupyter.service 
Description=Jupyter Lab

ExecStart=/usr/local/bin/jupyter-lab --config=/home/ubuntu/.jupyter/


However, during boot I have TERMSGN 15.

$ sudo service jupyter status
● jupyter.service - Jupyter Lab
   Loaded: loaded (/etc/systemd/system/jupyter.service; enabled; vendor preset: enabled)
   Active: inactive (dead)

Oct 24 18:10:21 jupyter jupyter-lab[336]: [I 18:10:21.456 LabApp] JupyterLab extension loaded from /usr/local/lib/python3.6/dist-packages/jupyterlab
Oct 24 18:10:21 jupyter jupyter-lab[336]: [I 18:10:21.456 LabApp] JupyterLab application directory is /usr/local/share/jupyter/lab
Oct 24 18:10:21 jupyter jupyter-lab[336]: [I 18:10:21.458 LabApp] Serving notebooks from local directory: /home/ubuntu
Oct 24 18:10:21 jupyter jupyter-lab[336]: [I 18:10:21.458 LabApp] The Jupyter Notebook is running at:
Oct 24 18:10:21 jupyter jupyter-lab[336]: [I 18:10:21.458 LabApp] https://jupyter:8888/
Oct 24 18:10:21 jupyter jupyter-lab[336]: [I 18:10:21.458 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Oct 24 18:10:38 jupyter jupyter-lab[336]: [C 18:10:38.951 LabApp] received signal 15, stopping
Oct 24 18:10:38 jupyter jupyter-lab[336]: [I 18:10:38.952 LabApp] Shutting down 0 kernels
Oct 24 18:10:38 jupyter systemd[1]: Stopping Jupyter Lab...
Oct 24 18:10:39 jupyter systemd[1]: Stopped Jupyter Lab.

I feel that I’m missing something.