Unable to install Chromium inisde a docker container on M1 macbook - linux

I am Running docker on an M1 Macbook Pro , here i am using this docker script
FROM node:current-buster
# Create and set user
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get update && apt install -y ./google-chrome-stable_current_amd64.deb
This throws an error
google-chrome-stable:amd64 : Depends: libasound2:amd64 (>= 1.0.16) but it is not installable
and same for other dependencies
I have tried various ways:
changing base image
changing the installation step to
apt-get install -y wget gnupg ca-certificates procps libxss1 &&
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'&&
apt-get update &&
apt-get install -y google-chrome-stable
(This gives an error unable to locate package)
The script runs on a linux machine but for m1 mac it doesnt work.
I actually wanted to run puppeteer inside docker for which i am trying to install chrome incase there is an another way around.

docker buildx build --platform=linux/amd64
This allows us to build the image atleast. Not sure if running it would produce the same result on M1 machine but atleast the image is built
EDIT::
so chrome has no arm image and that was the main cause for this problem changing it to chromium on base ubuntu 18.04 seems to work fine
FROM ubuntu:18.04
RUN apt-get install -y chromium-browser

It should work on both debian and ubuntu, try first to run sudo apt update after that it was able to install arm build of chromium.

Related

Chromedriver Installation using Docker file but the chrome driver does not reflect in the mentioned directory

Set base image (host OS)
FROM python:3.8
RUN apt-get update && apt-get install -y \
python-pip
Installing wget command
RUN pip install wget
Copy the dependencies file to the working directory
COPY requirements.txt .
Install dependencies
RUN pip install -r requirements.txt
Trying to install the chrome driver
RUN wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/88.0.4324.96/chromedriver_mac64.zip
Why are you using chrome driver for mac distribution in ubuntu container ? I am not sure of what's beneath it, but I guess there might be some issues due to os type.(Not sure)
You can try adding the ubuntu distribution as shown below, it should work.
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - \
sudo sh -c 'echo "deb https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
sudo apt-get -y update \
sudo apt-get -y install google-chrome-stable
RUN sudo apt-get -y install chromium-chromedriver

Problem with Android Studio emulator in Docker container

I have a Docker container with Android studio 3.6 and it works perfectly. The problem is that the emulator does not run because the Ubuntu machine does not have the CPU to reproduce x86. Does anyone know how to include it in the Dockerfile ?. Thank you.
This is my Dockerfile:
FROM ubuntu:16.04
RUN dpkg --add-architecture i386
RUN apt-get update
# Download specific Android Studio bundle (all packages).
RUN apt-get install -y curl unzip
RUN apt-get install -y git
RUN curl 'https://uit.fun/repo/android-studio-ide-3.6.3-linux.tar.gz' > /studio.tar.gz && \
tar -zxvf studio.tar.gz && rm /studio.tar.gz
# Install X11
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get install -y xorg
# Install other useful tools
RUN apt-get install -y vim ant
# install Java
RUN apt-get install -y default-jdk
# Install prerequisites
RUN apt-get install -y libz1 libncurses5 libbz2-1.0:i386 libstdc++6 libbz2-1.0 lib32stdc++6 lib32z1
RUN apt-get install wget
RUN wget 'https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip' -P /tmp \
&& unzip -d /opt/android /tmp/sdk-tools-linux-4333796.zip
RUN apt install xserver-xorg-video-amdgpu
# Clean up
RUN apt-get clean
RUN apt-get purge
ENTRYPOINT [ "android-studio/bin/studio.sh" ]
When you're using ubuntu in docker, the only way to run an android emulator is to find a system image with "arm" (e.g. system-images;android-25;google_apis;armeabi-v7a).
However, even though you're able to run emulator in the container, you will probably be disappointed about that. Since emulator based on arm is typically slow enough to boot, not to mention that running in docker could be even slower.
If you really want to create it, you can do something like below.
sdkmanager "system-images;android-25;google_apis;armeabi-v7a"
avdmanager create avd -n demoTest -d "pixel" -k "system-images;android-25;google_apis;armeabi-v7a" -g "google_apis" -b "armeabi-v7a"
emulator #demoTest -no-window -no-audio -verbose &
Once you got this prompt message
emulator: got message from guest system fingerprint HAL
Your emulator is ready to go.

Unable to find libssl.so.1.0.2 and libssl.so.1.0.2 when trying to use PyODBC on a Docker image

I have a docker file which uses python:3 (based on debian). I am installing the drivers for PyODBC as per the microsoft docs.
FROM python:3
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
apt-get update && \
ACCEPT_EULA=Y apt-get install msodbcsql17 unixodbc-dev -y
I can build the image, but when trying to run it I get the error: Can't open lib /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1
I have ran: ldd /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1 and get the output that says the below two libs cannot be found:
libcrypto.so.1.0.2 => not found
libssl.so.1.0.2 => not found
I have also tried dpkg --search libssl and dpkg --search libsslcrypto which yielded:
libssl1.1:amd64: /usr/lib/x86_64-linux-gnu/libssl.so.1.1
libssl1.1:amd64: /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
From ldd /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1 there are other libraries being picked up in /usr/lib/x86_64-linux-gnu/
Very new to docker/linux, so how can I install libcrypto.so.1.0.2 and libssl.so.1.0.2 or downgrade the versions in '/usr/lib/x86_64-linux-gnu/' so that they can be used for msodbcsql17 (have tried apt get -y install libssl1.0=1.0.2) ?
The docker image python:3 appears to be built on Debian 10.
The package repository you are installing appears to be built for Debian 9, and does not appear to be compatible with Debian 10.
You should probably be using the repository with packages built for Debian 10 to get compatible packages.

Setting Up a Debian Docker image with older boost library

I have an already compiled Linux app which has become dated. To use it, I want to create a Docker image and an appropriate environment to work with. My problem is that is app requires an older version of the boost libraries. 1.57.0 to be specific.
I have been able to get boost installed (I believe correctly) but the app errors out.
The error that I am getting is:
undefined symbol: _ZN5boost15program_options3argE
I am hoping someone has experience with this. Briefly, my pipeline is:
get the rocker/verse Docker image that has Debian and R and some more goodies I need.
Bash in to it, apt-get install ... etc.
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential g++ python-dev autotools-dev libicu-dev build-essential libbz2-dev libboost-all-dev
cd home
wget -O boost_1_57_0.tar.gz https://sourceforge.net/projects/boost/files/boost/1.57.0/boost_1_57_0.tar.gz/download
tar xzvf boost_1_57_0.tar.gz
cd boost_1_57_0
./bootstrap.sh --with-libraries=atomic,chrono,context,coroutine,container,date_time,exception,filesystem,graph,graph_parallel,iostreams,locale,log,math,mpi,program_options,python,random,regex,serialization,signals,system,test,thread,timer,wave
./b2 toolset=gcc cxxflags=-std=gnu++0x
sudo ./b2 install
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
-----Edit: added additional bash code that was missing here
sudo sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf.d/local.conf’

Docker - Unable to locate package docker-engine

I am trying to install docker in Ubuntu 16.04. I am following this link for docker installation. I am ending up with Unable to locate package docker-engine
My current kernal version - 4.4.0-38-generic
Ubuntu version - 16.04
The docker package already inside Ubuntu is called docker.io [1] so just do
sudo apt-get install docker.io
But if you follow that link you gave and do steps 7, 8, 9 then your installation will know about the package at the docker repo and also find docker-engine.
Your call. I run the Ubuntu version (currently 0.11.2 on Ubuntu 16.04) on some machines, and the one from Docker on others (as I was curious about some 0.12 features). Both will work just fine.
[1] As docker is used for a desktop launcher application 'docking' icons.
I faced the same issue on AWS-EC2 with ubuntu-18.04 server...
running apt-get update does the trick for me....
Once update runs fine then run apt-get install docker.io
Docker-compose-plugin is put into the docker.io repo.
Running sudo apt install docker.io ,or apt-get in older Ubuntu versions, will also get you the files you need. First you will need to run update to make sure you have most recent versions. sudo apt update
The main solution which solved most of the issues in docker is installing 64-bit version of ubuntu. I was running with 32-bit(i686). Hope it helps ! !
I wasn't able to install docker with the current other solutions but managed to get rid of the "Unable to locate package docker-engine" error with a solution mentioned on the GitHub repo issues (issue of May 31, 2020).
The solution was to run these commands:
sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io

Resources