GUI CONTAINER ON DOCKER

Mohammed Adnan
2 min readJun 1, 2021

Summer Program 2021 #Task2

🧾Task Description:

- Launch a GUI supported container on docker

- Run any GUI software on the container

Step1: Check the Docker

We use the command:

docker info

if Docker is unavailable, We use the command:

yum install docker-ce

Step-2: Pull container image and run the container

To pull the container, We use the command:

docker pull centos

Run the container, We use the command:

docker contaiiner run -it — net=host — name=<container_name> -env= DISPLAY<docker_image>:<version>

Explanation of code

docker container run -i -t — name=<name> centos:latest is The conventional code of creating a container with interactive(-i) terminal(-t).

net=host- to configure the container's network so that it shares the network interface with the host.
1. This allows us to use the internet inside our docker without further configuration.
2. It allows the x-11 connection to run on the host.

env= DISPLAY- We specify that the environmental variable ‘DISPLAY’ will be the same inside container as well as the host machine.

Step-3: Installing python3 and other softwares

i) Install Python

We use the command:

yum install python3

ii) Install Firefox

We use the command:

yum install firefox

iii)Install Jupyter Notebook

Python3 has a dependency called pip3

We use the command:

pip3 install jupyter

Step 4: Launch the GUI

Launch the Jupyter Notebook, We use the command:

jupyter notebook — allow-root

A Firefox Window opens with Jupyter running in it

Thank you!

--

--