RUN Any GUI Program on Container

Questions is can you run any program on Container, Answer is yes you can run any GUI Program on Container. Only need to know the basic concept of docker and some vocabulary.

Here I'm going to run ZOOM on the top of Container.

  • item 1 First download a zoom for your operating system
  • item 2 Pull Docker image centos you use this command docker pull centos
  • item 3 Now Create a dockerfile

To create a dockerfile we need base OS for this we all ready pull CentOS from Docker Hub, And we already downloaded zoom package for our Operating System. For this just copy zoom rpm package to container.

After completing base portion, Now move ahead and install the package and execute the zoom program.

Remember this thing we don't have to do manually, it will be scripted with docker file.

FROM centos

COPY zoom* /

RUN yum -y localinstall zoom_x86_64.rpm

CMD ["/usr/bin/zoom"]

After creating Docker file, Now we need to build, (Build means you have to compile your source code into machine code so your system can run or execute the file.) exactly build command can do this thing for you create docker file build it. It will give you container image.

So command syntax something like this docker build docker is command and build is argument an location of folder (where your dockerfile is, you don't have to give file name it will pick up automatically) and -t for Name and optionally a tag in the 'name:tag' format

docker build /root/Documents/docker/ -t zoom:V1 In my case location is this, in your case it should be difference.

After creating a Image, It's good practice to give initialization server, X11 for Graphic.

For this we have command called xhost + currently this server is enable but you have to disable for clients can connect from any host to display GUI program.

Point to remember

Give name “root” here otherwise zoom will exit automatically, even in any situation where you give wrong id pass or anything incorrect it will crash immediately so give correct details

sudo docker run -it --rm -e --net=host --env="DISPLAY" -v /temp./X11-unix:/tmp/.X11-unix --net=host zoom:test

After executing this command might it give you blank screen, I suggest double-click on it, Then you good to go.

I already uploaded on Docker Hub, If you want you can pull it.

20