Run Google Chrome On a Docker Container Using –env="DISPLAY"

  docker, google-chrome, linux-mint, ubuntu-20.04

I am using Linux Mint 20.2

I used the following commands to install google chrome on ubuntu 20.04 image.

$ sudo docker run -it --name os2 --env="DISPLAY" ubuntu:20.04
[email protected]:/# apt update
[email protected]:/# apt install wget
[email protected]:/# wget
[email protected]:/# apt install ./google-chrome-stable_current_amd64.deb

Just to be clear, I need to use chrome with the GUI. That is why I used --env="DISPLAY". However, when I try to run google chrome using google-chrome --no-sandbox it gives the following error.

[email protected]:/# google-chrome --no-sandbox
[5970:5970:0917/] Unable to open X display.
[email protected]:/# [0917/] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly

What can be the solution to run google chrome inside docker?

Source: Docker Questions