Feulo
Feulo

Reputation: 537

Starting firefox insde container makes new window in host firefox

I am currently trying to make an docker container that connect to a VPN (via openforivpn) and the open a Firefox instance to use with that connection. When there is no Firefox running in my host, everything works fine, the container start the VPN connection and the open the Firefox application connected to my X server. But if I have my host Firefox is running, when I start the container it opens a new window on my host Firefox and the exit the container with the message:

feulo@branca:~/vpen-test$ docker-compose up
Recreating 07_complex_compose_openfortivpn_1 ... done
Attaching to 07_complex_compose_openfortivpn_1
07_complex_compose_openfortivpn_1 exited with code 0

Anyone kwonws how to fix it? Thanks for the helping

These are de Dockerfile and docker-compose.yml files

Dockerfile

# Use an official Debian Slim image
FROM debian:buster-slim 
# Install needed packages
RUN  apt update \
   &&  DEBIAN_FRONTEND="noninteractive" apt -y install  dbus ppp openfortivpn iceweasel

docker-compose.yml

version: '3.2'
services:
    openfortivpn:
        working_dir: /workdir
        build: .
        privileged: true
        devices:
            - /dev/snd
        volumes:
            - .:/workdir
            - /tmp/.X11-unix:/tmp/.X11-unix
        environment:
            - DISPLAY=unix$DISPLAY
        command:  sh entrypoint.sh

entrypoint.sh

openfortivpn -c dti.txt &
firefox

Upvotes: 0

Views: 512

Answers (1)

Feulo
Feulo

Reputation: 537

found the solution in Docker with shared X11 socket: Why can it "start" Firefox outside of the container?

just need to add -new-instance to Firefox

Upvotes: 1

Related Questions