40

I am trying to install the chrome browser in a docker image with

RUN apt-get install chromium-browser

but I get the error:

Package chromium-browser is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'chromium-browser' has no installation candidate

How to correctly install chromium in a docker image?

Alex
  • 41,580
  • 88
  • 260
  • 469

3 Answers3

47

If you happen to be running a Debian-based image, the package you want is chromium (vs chromium-browser). So, for such images, this'll take care of it for you:

RUN apt-get install chromium -y
verespej
  • 710
  • 6
  • 9
  • Thanks [@revisto](https://stackoverflow.com/users/13622976) for catching my grammatical error and suggesting adding the `-y` to the `RUN` command! – verespej Mar 31 '21 at 13:17
  • what about `chromium-chromedriver`? It says `no installation candidate` as well – Superbman Oct 30 '21 at 11:57
  • 1
    @Superbman Make sure to `apt-get update` first. If that doesn't help, maybe try searching the package listings for the particular flavor/version you're running? E.g. https://www.debian.org/distrib/packages, https://packages.ubuntu.com/, etc. – verespej Nov 01 '21 at 21:01
  • 1
    I figured what the issue was. It turns out they renamed `chromium-chromedriver` to `chromium-driver` – Superbman Nov 03 '21 at 02:51
  • 1
    That's great @Superbman! Glad you were able to resolve it. Thanks for sharing the resolution. – verespej Nov 03 '21 at 16:38
  • 1
    This was a good fix for armbian 22, thank you. Also I used sudo and not RUN for linux. – Exzile May 13 '22 at 01:51
  • 2
    You saved my day with this answer , it worked for me after day of struggling , I can't thank you enough! – Spartacus Jun 15 '22 at 09:33
  • Makes my day to hear it was helpful! – verespej Jun 15 '22 at 22:48
32

I solved it directly downloading Google Chrome

# install manually all the missing libraries
RUN apt-get install -y gconf-service libasound2 libatk1.0-0 libcairo2 libcups2 libfontconfig1 libgdk-pixbuf2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libxss1 fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils

# install chrome
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install
Paul Verest
  • 60,022
  • 51
  • 208
  • 332
Alex
  • 41,580
  • 88
  • 260
  • 469
5

Use the following to install chrome in a docker container:

RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN dpkg -i google-chrome-stable_current_amd64.deb --fix-missing; apt-get -fy install`
  • Your answer has a ` at the end of the second RUN that makes it return an error, but without it everything goes smoothly – Silkking Oct 28 '20 at 17:11