How to install chromium in Docker based on Ubuntu 19.10 and 20.04? - docker

I have this simple docker file:
FROM ubuntu:eoan
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y \
chromium-browser \
chromium-chromedriver
When I try to build it:
...
Preparing to unpack .../00-chromium-browser_77.0.3865.120-0ubuntu1.19.10.1_amd64.deb ...
=> Installing the chromium snap
==> Checking connectivity with the snap store
===> Unable to contact the store, trying every minute for the next 30 minutes
And it seems that it never reaches the said snap store.
It works fine if the image is based on disco instead of eoan.
It works fine on a physical machine.

It's not a solution, it's a workaround. Just use google-chrome instead.
I faced with this issue when suddenly in one day that docker image that always was building become broken. My case was like your: ubuntu 19.10 as a base for docker image.
RUN curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get install -y ./google-chrome-stable_current_amd64.deb
RUN rm google-chrome-stable_current_amd64.deb

Related

How to add chrome browser to TestCafe docker image?

TestCafe docker image is having only chromium,firefox. I want use same image to run tests on chrome & tried to build docker image by installing chrome browser using testcafe base image (linux/amd64). But running into issues.
docker run -v ${PWD}/tests:/tests -it testcafe/testcafe chromium,firefox tests/shared/abc.js
https://devexpress.github.io/testcafe/documentation/guides/advanced-guides/use-testcafe-docker-image.html#test-in-docker-containers
apt-get is the package manager for Ubuntu and other Debian-based distros,
apk for Alpine
for my base image type linux/amd64(https://hub.docker.com/r/testcafe/testcafe/tags?page=1&ordering=last_updated)
ERROR [2/5] RUN apk update && apk add --no-cache
ERROR [2/5] RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && sudo dpkg -i google-chrome-stable_current_amd64.deb
Was trying like below in docker file:(Not sure exact preprequisites section & install Chrome section)
#Step 0: Choose base
FROM testcafe/testcafe
#Step 1 : Install the pre-requisite
RUN apk update
RUN apt-get install -y curl
RUN apt-get install -y p7zip
p7zip-full
unace
zip
unzip
bzip2
#Version numbers
ARG CHROME_VERSION=89.0.4389.114
#Step 2: Install Chrome
RUN curl http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_$CHROME_VERSION-1_amd64.deb -o /chrome.deb
RUN dpkg -i /chrome.deb
RUN rm /chrome.deb
CMD ["echo", " hello, Welcome to Kiran's custom testcafe docker image!"]
Appreciate if anyone suggest commands in docker file for this object.
Unfortunately, there seems to be no reliable way to install Google Chrome on Alpine Linux. The dpkg package used in your example is intended for Debian-based distributions. While it is available on Alpine Linux as well, it is usually good for lightweight packages only. With heavy packages, it is likely to fail because some of its dependencies are unavailable on Alpine.
That is why the apk package manager is preferred for Alpine Linux. However, google-chrome is not available for apk (only chromium is). See https://stackoverflow.com/a/58781506.
If you need to use a full-featured google-chrome for testing, please consider using a Debian-based Docker image instead of the Alpine-based TestCafe image.

Install Java runtime in Debian based docker image

I am trying to install the java runtime in a Debian based docker image (mcr.microsoft.com/dotnet/core/sdk:3.1-buster). According to various howtos this should be possible by running
RUN apt update
RUN apt-get install openjdk-11-jre
The latter command comes back with
E: Unable to locate package openjdk-11-jre
However according to https://packages.debian.org/buster/openjdk-11-jre the package does exist. What am I doing wrong?
Unsure from which image your are pulling. I used slim, Dockerfile.
from debian:buster-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN mkdir -p /usr/share/man/man1 /usr/share/man/man2
RUN apt-get update && \
apt-get install -y --no-install-recommends \
openjdk-11-jre
# Prints installed java version, just for checking
RUN java --version
NOTE: If you don't run the mkdir -p /usr/share/man/man1 /usr/share/man/man2 you'll run into dependency problems with ca-certificates, openjdk-11-jre-headless etc. I've been using this fix provided by community, haven't really checked the permanent fix.

Same Dockerfile gives different outcomes during build

I am refactoring an angular application to switch from a VM architecture to Docker containers.
While building the container for Angular I came up with a Dockerfile to use as a builder in the multistage build. I worked like a charm on my Mac so i pushed it to our company github to be consumed by my colleagues.
The problem rise up when a colleague pulled from the repo and tried to build on his Mac (different models but more or less comparable, mine is a 2015, his is a 2016, both running Mojave).
This is the content of the dockerfile that is erroring:
# base image
FROM node:9.6.1 as builder
# install chrome for protractor tests
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:fontforge/fontforge
RUN apt-get install -y google-chrome-stable
RUN apt-get install -y fontforge ttfautohint gettext
I was assuming it to build fine as it was on my laptop but when he tries to launch the build he receives some errors in the step RUN apt-get update
The container gets a 404 while trying to update systemd and exits.
We tried also to spin up a new container FROM THE SAME image docker run --rm -it node:9.6.1 /bin/bash and copy-pasting all the instructions manually in the command line and it worked fine.
1. Why two different outcomes in two very similar but still different machines?
The entire point of docker containers should be abstracting the environment and create standalone environments for your applications, so why the same Dockerfile blueprints work perfectly on my machine and do not on his?
Also the docker demon runs fine and it starts the container, the issue we have is during the system upgrade inside the container build.
2. Why on the same machine, the Dockerfile build fails while the same steps succeed if run manually?
This completely blew up my mind, i may even understand the two different machines issue, but i cannot find any logical explanation to this one: same commands fed to command line work while they don't if executed via script.
apt-get update, in particular, generates results that vary over time. These include URLs to Debian packages, and standard Debian package management practice is to remove a package from the repository listings as soon as there’s a newer version.
If you previously ran the Dockerfile up through the RUN apt-get update, and then later changed what specific packages get installed, you could wind up in a state where Docker cached the results of the update operation, but they’re no longer valid.
The usual answer to this is to make sure to run apt-get update && apt-get install in a single RUN step:
RUN apt-get update \
&& apt-get install -y software-properties-common
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
RUN add-apt-repository -y ppa:fontforge/fontforge
RUN apt-get update \
&& apt-get install -y google-chrome-stable fontforge ttfautohint gettext

I am trying to install gitlab omnibus packages on a ubuntu container

I lunched a container with
docker container run -it ubunutu
and run some commands :
apt-get update && apt-get upgrade -y
apt-get install curl openssh-server ca-certificates
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | bash
apt-get install gitlab-ce
until now it was all fine, but when I run gitlabctl reconfigure, It start and always stops in this step of installation ruby_block[supervise_redis_sleep] action run
Is there any solution to this problem??
I am using the latest version of ubuntu image, I also tried debian image. But all of them stop at that step!!
This is when I run apt-get install gitlab-ce , it was fine
but now when I run gitlab-ctl reconfigure , it stops always here
ruby_block[supervise_redis_sleep] action run

Could not run Calabash-android on docker

I am integrating a Calabash-android test on docker. The entire setting up and running Calabash in my local was quite easy and when it comes to docker I could not run the test yet. I have been trying this for the past two weeks and did not get any positive response while trying to run the emulator. Finally according to the suggestion from an android expert I have end up using the below-given docker file,
FROM tracer0tong/android-emulator
RUN apt-get -y install python-software-properties && apt-add-repository -y ppa:brightbox/ruby-ng && apt-get update && apt-get -y install r uby2.2
#install android dependencies
RUN apt-get update
RUN apt-get -y install lib32stdc++6 lib32z1 lib32z1-dev
RUN gem install calabash-android
ENV ANDROID_HOME /usr/local/android-sdk
ENV GRADLE_HOME /usr/local/gradle
ENV ANDROID_SDK_HOME $ANDROID_HOME
ENV PATH $PATH:$ANDROID_SDK_HOME/tools
ENV PATH $PATH:$ANDROID_SDK_HOME/platform-tools
ENV JAVA_HOME /usr/lib/jvm/java-7-oracle
After building the image by using the above dockerfile everything seems installed properly but whenever I try to run the emulator it is raising an error as if the emulator does not exist. And the below one as well. It would be appreciated if someone come forward to give a helping hand to fix the blocker.
appt is not found

Resources