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=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

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!

Nehemiah C

Software Engineer at ANPI

2 年

is it possible in windows docker?

回复
Adolfo R.

Finance, Operations, Technology, Change Management

3 年

Great thing! Have you tried it over Windows Docker?

回复

要查看或添加评论,请登录

Yash Indane的更多文章

  • Use of K-mean clustering in security domain

    Use of K-mean clustering in security domain

    Summer Task-10 & ARTH Task 42 Github -> What is K-means Clustering? K-means clustering is one of the simplest and…

  • OSPF Routing Protocol using Dijkastra Algorithm

    OSPF Routing Protocol using Dijkastra Algorithm

    What is OSPF? The OSPF (Open Shortest Path First) protocol is one of a family of IP Routing protocols, and is an…

  • Using Face Recognition for automation

    Using Face Recognition for automation

    SUMMER-TASK-6 (Team Task) and ARTH TASK 38 GitHub -> In this article I will explain how we can use Face Recognition and…

    3 条评论
  • JavaScript use cases in Industry

    JavaScript use cases in Industry

    Summer Task 7.2 What is JavaScript? JavaScript, often abbreviated as JS, is a programming language that conforms to the…

    1 条评论
  • Use of confusion matrix in detecting cyber crime

    Use of confusion matrix in detecting cyber crime

    Summer 2021 Task 05 ??????? Particularly in the last decade, Internet usage has been growing rapidly. However, as the…

  • Training a ML model inside a container

    Training a ML model inside a container

    Task 01 ??????? Task Description ?? ?? Pull the Docker container image of CentOS image from DockerHub and create a new…

    4 条评论
  • Deploying WordPress in Amazon EKS with RDS in Backend

    Deploying WordPress in Amazon EKS with RDS in Backend

    ARTH-TASK-23 WordPress is a free and open-source content management system written in PHP and paired with a MySQL or…

    3 条评论
  • How industry uses MongoDB

    How industry uses MongoDB

    ARTH-TASK-32 What is MongoDB? MongoDB is a source-available cross-platform document-oriented database program…

  • Creating a Multicloud Setup of Kubernetes using Ansible Roles

    Creating a Multicloud Setup of Kubernetes using Ansible Roles

    TASK 28 Task Description ?? ?? CREATE A MULTI-CLOUD SETUP of K8S cluster: ?? Lunch node in AWS ?? Lunch node in Azure…

    2 条评论
  • Helm and Charts in Kubernetes

    Helm and Charts in Kubernetes

    ARTH TASK 24 What are Charts ? A chart is a collection of files that describe a related set of Kubernetes resources. A…

社区洞察