How to run firefox inside docker container?

0 votes

I have one docker container in my centos base system. But I am not able to run firefox from my container.

How can I do that?

Apr 16 in Docker by akhtar
• 11,270 points
480 views

1 answer to this question.

0 votes

Hi@akhtar,

Generally, if you run firefox inside docker container you will get the below error.

[root@1c3a22e43538 /]# firefox
Failed to open connection to "session" message bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Running without a11y support!
Error: no DISPLAY environment variable specified

But you can use firefox inside your docker container. Follow the below given steps.

  • Run xauth list command in your host machine and copy the cookies.

[root@vm1 ~]# xauth list
vm1/unix:0  MIT-MAGIC-COOKIE-1  b4c39c85be9a907749dd9395f4175b0d
  • Run docker container with environment variable Display and also mount /tmp/.X11-unix folder to your container.

[root@vm1 ~]# docker run -it --name firefox --net=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix centos:7 bash
[root@vm1 /]#
  • Install firefox and xauth inside container.

$ yum install firefox xauth
  • Add cookies that you copy from your host machine.

$ xauth add <cookies>
  • Run firefox inside docker container, it will work.

Hope this will help you.

answered Apr 16 by MD
• 24,500 points

Related Questions In Docker

0 votes
1 answer

How to run a docker command from inside the container?

You must have come across the /var/run/docker.sock file, ...READ MORE

answered Jun 28, 2018 in Docker by Sophie may
• 9,940 points
968 views
0 votes
1 answer

How to run a cron job inside a docker container?

Hii, crond works well with tiny on Alpine RUN apk add --no-cache ...READ MORE

answered May 18 in Docker by Niroj
• 23,950 points
42 views
+2 votes
12 answers
0 votes
2 answers

How to execute docker exec commande inside a docker container ?

You need to get inside the container ...READ MORE

answered Aug 13, 2019 in Docker by Sirajul
• 53,110 points
792 views
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 57,530 points
542 views
+1 vote
1 answer

How to run jenkins service inside docker container?

Hi@akhtar, By default systemctl command will not run ...READ MORE

answered May 12 in Docker by MD
• 24,500 points
138 views
+1 vote
1 answer

How to plot graph inside docker container?

Hi@akhtar, To plot a graph we generally use ...READ MORE

answered May 19 in Docker by MD
• 24,500 points
120 views