Running Chrome in Docker container
Yash Indane
Tech Enthusiast | Integrating Technologies | 1x AWS Certified | 6x Microsoft Certified | Cloud Computing | DevOps
Summer - Task 02 ???????
By default containers don't support GUI, but by some way we can achieve that, let's discuss
Lets start docker
Now lets launch a container (with centos:7 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=https://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
Now let's try to run chrome
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
After configuring yum repo and installing chrome as same we did for first container, now launch chrome in this container
google-chrome --no-sandbox
Now chrome runs inside the container, as we had mentioned DISPLAY variable while launching this container!
Software Engineer at ANPI
2 年is it possible in windows docker?
Finance, Operations, Technology, Change Management
3 年Great thing! Have you tried it over Windows Docker?