Running Chrome in Docker container

Running Chrome in Docker container

Summer - Task 02 👨🏻‍💻

By default containers don't support GUI, but by some way we can achieve that, let's discuss

Lets start docker

No alt text provided for this image

Now lets launch a container (with centos:7 image)

No alt text provided for this image

Chrome-Installation

Go to /etc/yum.repos.d and make a file google-chrome.repo and put this ->

[google-chrome]
name=google-chrome
baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub

install by

yum install google-chrome-stable

Now update the installation

No alt text provided for this image

Now let's try to run chrome

No alt text provided for this image

We see the error here because we didn't mention the display variable.

The DISPLAY variable is used by X11 to identify your display. While launching this container I did not specify any DISPLAY Variable. Without the display variable we can't run GUI apps inside a container.

Now let's launch a new container with DISPLAY variable

No alt text provided for this image

After configuring yum repo and installing chrome as same we did for first container, now launch chrome in this container

google-chrome --no-sandbox

No alt text provided for this image

Now chrome runs inside the container, as we had mentioned DISPLAY variable while launching this container!

is it possible in windows docker?

Like
Reply

Great thing! Have you tried it over Windows Docker?

Like
Reply

To view or add a comment, sign in

Explore content categories