LAUNCHING FIREFOX ON DOCKER
Namaste! technical people here I came up with a new blog on launching a GUI application on the top of the docker. Actually what we are going to do is that we are going to create an image for the docker which will be capable to launch the uncountable containers with the capability of starting the GUI application. In this case we are going to launch Mozilla Firefox in the docker container.
So, let us start creating this amazing and wonderful setup but first let me introduce you with some terminologies which are very important for this setup to be done and understood.
If you are very new to the technology please refer to this blog to understand some operations of the docker.
RUNNING PYTHON INTERPRETER ON THE TOP OF DOCKER
Namaste! amazing people here comes a new blog on launching the Python Interpreter on the top of the Docker container…
Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allow you to run many containers simultaneously on a given host. Containers are lightweight and contain everything needed to run the application, so you do not need to rely on what is currently installed on the host. You can easily share containers while you work, and be sure that everyone you share with gets the same container that works in the same way.
A DockerFile is a text document which is made to assemble the Docker Image which is like an CD or ISO file used to launch and configure the OS. It is a script written which consist of all the packages, their configuration, running processes and programs installed which is further converted into an image by use of docker build command. It is a main script behind every image made and pushed on the Docker Hub.
A Docker image is a file, comprised of multiple layers, that is used to execute code in a Docker container. An image is essentially built from the instructions for a complete and executable version of an application, which relies on the host OS kernel. When the Docker user runs an image, it can become one or multiple instances of that container.
X server is a windowing system for bitmap displays, common on linux operating systems. There are several ways one can connect a container to a host’s X server for display. The current version of this is x11. A brief description and tradeoffs for each method below:
- The first listed is simple, but unsecure.
- The second is safer, but non-isolated.
- The third is isolated, but not as portable.
- The fourth is isolated, works remotely, but is slow.
Prerequisites for the Setup :
- RHEL 8 installed
- Docker installed
Now after having the knowledge about the terminologies we can now move forward for building the proposed setup.
So first of all let us check whether the docker service is running or not.
To start the Docker service in the operating system use the command shown below.
To check the status of the service use the command shown below.
Now once the service is started we will be now going to create a DockerFile. For doing this follow the steps mentioned below.
STEP-1 Make a Directory
The command for creating a directory is mkdir <dir name> as shown below.
STEP-2 Go to the Directory and create file with name Dockerfile.
Go inside the directory with the cd command and make the file with the name Dockerfile as shown below.
STEP-3 Write the Code for the File.
Write the code in the file as shown below.
STEP-4 Build the Dockerfile
We now need to build the Docker file for making it an image by the command shown below.
Now after this is done the image is created and to check it we can now check it by the command shown below.
Now we will be launching a container through this image and after that we will be seeing that the Firefox will be launched in the container itself.
- Launching the Container
If you want that UI application to display the user interface on your local machine while running the application inside the Docker Container, you will have to connect the display of the Docker Container with the display of your local machine.
And Hurray!! The Firefox is now launched and running on the top of docker successfully.