GUI container on the Docker

Sri Raviteja
3 min readMay 31, 2021

Summer Program 2021 — #Task2

Task Description:

- Launch a container on docker in GUI mode

- Run any GUI software on the container

Here we go…

Step-1: Check for the Docker

Use the below command to check for the Docker

docker info

if Docker unavailable, use:

yum install docker-ce

Pull the OS to work with

docker pull centos

Step-2: Launch the Container

To launch the Container use the command,

docker run -it — name=<container_name> -net=host — env=”DISPLAY” — volume=”$HOME/.Xauthority:root/.Xauthority:rw” <docker_image>:<version>

to break down the code:

run- to launch the container
it- for interactive terminal
net=host- to launch with host network
env=”DISPLAY”- Display of the host
volume=”$HOME/.Xauthority:root/.Xauthority:rw”- to share the Xserver from the host to container by creating a volume

and the container starts running…

Step-3: Installing required packages

i) Installing Python

To install Python in the container, run the command while in the container’s terminal :

yum install python3

after the installation is done, run the command :

rpm -q python3

to check the version installed.

ii) Installing Firefox

To install the Firefox web browser in the container, run the command:

yum install firefox

to check the version installed, run the command:

rpm -q firefox

iii)Jupyter Notebook

As the Python is already installed from the Step-3.i

Run the command:

pip3 install jupyter

It installs the notebook and other required libraries to run it.

Step 4: Launch the GUI

Launch the Jupyter Notebook, by using the command:

jupyter notebook —allow-root

A Firefox Window opens with Jupyter running in it

That’s all Folks!!

#vimaldaga #righteducation #educationredefine #rightmentor #worldrecordholder #linuxworld #makingindiafutureready #righeducation #arthbylw #docker #container

--

--