GUI on the Docker 🐋
✨ What is Docker ?
Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. Because all of the containers share the services of a single operating system kernel, they use fewer resources than virtual machines.
Task Description 📄
📌 GUI container on the Docker
🔅 Launch a container on docker in GUI mode
🔅 Run any GUI software on the container
Let’s Begin🤩
Step1 : Install docker
A ] Configure yum for Docker :
Create a file “/etc/yum.repos.d/docker.repo”[docker]name=docker repo baseurl=https://download.docker.com/linux/centos/7/x86_64/stable/
gpgcheck=0
After this verify by “yum repolist” . You see some more software.
B] Install Docker and start service :
# Install docker
yum install docker-ce — nobest # Start Docker service
systemctl start docker# Enable Docker service
systemctl enable docker
Step2 : Pull centos image
docker pull centos:latest
Step3 : Launch a container
docker run -it — name <os_name> — net=host — env=”DISPLAY” — volume=”$HOME/.Xauthority:/root/.Xauthority:rw” <image>:<version>
- We have to provide this as a option to share docker host i.e in our case RHEL8 XServer.
# share the Host’s XServer with the container by creating a volume
--volume="$HOME/.Xauthority:/root/.Xauthority:rw"
# to share the host display environment to the container.
--env="DISPLAY"
# to run container with host network
--net=host
Now, run the container by providing these option.
Step3: Install required packages in container
# python # firefox
yum install python36 firefox -y
# installing required libraries for taskpip3 install jupyter
✨Let’s launch jupyter notebook inside container :
jupyter notebook