DigitalOcean, Docker, Dokku: Installing Firefox inside a container

I have an application which needs to use a headed browser periodically.

I want to Host it using Dokku.

  • How to run headless browser testing in docker container
  • How to use a separate file system for the Docker daemon related files at start up on AWS EC2
  • Set sysctl key in Kubernetes pod using Kops + Docker 1.11
  • docker notary : tls: oversized record received with length 20527
  • How to ssh to a docker container on ec2 ubuntu host from outside machine
  • Packer provisioning docker with chef-solo gets node name not found error
  • How can I install this into my DO container?

    When I run:

    dokku run MY_APP apt-get install firefox
    

    I get:
    E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/s/systemd/libsystemd-daemon0_204-5ubuntu20.9_amd64.deb 404 Not Found [IP: 91.189.91.15 80]
    .
    .
    .
    E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/u/ubufox/xul-ext-ubufox_2.9-0ubuntu0.14.04.1_all.deb 404 Not Found [IP: 91.189.91.15 80]

    After which running:

    dokku run MY_APP firefox
    

    returns:
    FATA[0000] Error response from daemon: Cannot start container … exec: “firefox”: executable file not found in $PATH

    I am aware that PhatomJS is a better solution but some third party gem I am using are dependant on a headed firefox browser.

  • Marathon - do not redeploy app when return code = 0?
  • Set ENV variable in container is not working, is every under “/usr/local/bin” executed on container run?
  • How to restart an existing Docker container in restart=“always” mode?
  • Unable to connect to published Docker port on OS X
  • Contents in the container's bind-mounted dir keep unchanged after mounting/umounting removable drive from the host
  • Using shared runners to access the gitlab registry
  • One Solution collect form web for “DigitalOcean, Docker, Dokku: Installing Firefox inside a container”

    From the error message you are getting when installing Firefox, it seems like your apt cache inside the Docker container is out-of-date. Running apt-get update first should resolve the problem.

    Though to run Firefox headless, you’ll need another step. You’ll need to prepend your command with xvfb-run which is part of the xvfb package. It will allow you to run commands in a virtual X server environment.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.