Launching GUI App Jupyter on Top of Docker Container.

Parth Patel
3 min readMay 30, 2021

Hello Everyone ,

Today I am Going To launch jupyter notebook inside docker container.

Prerequisites :-

  • Docker installed in OS.

If you don’t have docker installed and don’t have any knowledge about docker containers..Visit my previous blogs for more information.

🧠Deploying Machine Learning Models inside Docker Containers 🐳 | by Parth Patel | May, 2021 | Medium

By reading this blogs you will get all the knowledge about Docker Containers.

Let’ Start :-

Steps:-

First of all after installing docker and starting its services. you need to pull one docker image.

  • Pull one image. here I am pulling centos image.
docker pull centos

Now, as our image is pulled successfully we need to run our image.

  • Start docker container normally.
docker run -it centos

Now let’s install some GUI application like firefox and jupyter inside the container.

  • After the installation let’s start firefox.

It gives some error saying that no display environment variable specified. So we require some display environment to run GUI applications. So we need to define $DISPLAY while launching container.

  • Now launch one more container with env $DISPLAY, and install firefox.
docker run -it --net=host --env="DISPLAY" centos

Here I am also using Oops, 😅 it gave an error, now let understand the error, it needs one env variable for x11 Display, so we need to define $DISPLAY.

  • Now launch one more container with env $DISPLAY, and install firefox.
docker run -it --net=host --env="DISPLAY" centos

Here I am using — net = host, because I want to use network of host system. So everything for connecting and networking we will use our host system for it.

Now it Works perfectly.

we have some warnings but we can also remove that by installing some packages and software’s

  • Now Let’s install jupyter notebook.

But for installing jupyter notebook we first need to install python3.

yum install python3 -y
pip3 install jupyter
  • As installation is complete launch jupyter notebook.

Note :- we will be launching jupyter notebook in root user so we need to allow root user to use it.

jupyter notebook --allow-root

Now, we got the token, so note this token and give it whenever it requires.

Well Done, we have launched Jupyter Notebook Successfully on Docker Container.

Hope you understood the concept and performed this task with me.

GitHub Link :-

the-helel/Docker-GUI (github.com)

Thank you for reading my article🤗

Keep Learning💫Keep Sharing🤝🏻

Linkedin Profile :-

Do clap if this article was helpful. Good Day!

--

--

Parth Patel

ARTH Learner | Bigdata — Hadoop | Linux | Front-End Developer | Flask | Coding Enthusiast | Python | AWS | Ansible | Kubernetes