RUN GUI APPS IN A DOCKER CONTAINER
DOCKER — Docker is a container Technology and it installs + boot + login into a device in just a few seconds. Docker just opens a terminal it does not open a GUI Interface.
In this article, I am going to show how docker is opening GUI software like firefox and gedit.
Pre-requisites -
Docker already Installed on BaseOS.
Run the Docker Container -
>> docker run -it — name firefox — net=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix centos:7 bash
— name:- Assign a name to the container
— net:- Connect a container to a network
-e:- set environment variables
-v:- Bind a Volume
- “ docker run ” first create a container and then start it.
- “ host ” network mode gives IP of Host not the IP of Docker Host.
- “ X11 ” server communicates with clients like xterm, firefox, etc via some kind of reliable stream of bytes. For Example — if you run a container that binds to port 80 and you use host networking, the container’s application is available on port 80 on the host’s IP address.
INSTALL FIREFOX AND XAUTH
>>yum install firefox xauth -y
The above is the command to install firefox and the xauth program.
- The “ xauth ” program is used to edit and display the authorization information used in connecting to the X server. This program is usually used to extract authorization records from one machine and merge them into another (in the case when using remote logins or granting access to other users).
- Firefox is a GUI Browser.
INSTALL GEDIT
>>yum install gedit
The above is the command to install gedit which is a Graphical User Interface Editor.