Issue compiling Dockerfile on MacOS(apple Sillicon) - docker

This is my first time to use Docker
I build a Dockerfile and use the Vscode remote container to open folder in Container.
When I run this Dockerfile on Windows 11. It does not have any problem
But When I run it on MacOS(apple Sillicon). It have error.
after I step by step to check the Dockerfile.
I find that if I install g++multilib or libc6-dev-i386, it will get error.
I do not have any idea about why?
Dockerfile:
FROM ubuntu:18.04
RUN apt update \
&& apt-get -y install gcc g++ python \
&& apt-get -y install python-dev \
&& apt-get -y install qt4-dev-tools libqt4-dev \
&& apt-get -y install mercurial \
&& apt-get -y install bzr \
&& apt-get -y install cmake libc6-dev \
&& apt-get -y install gdb valgrind \
&& apt-get -y install flex bison libfl-dev \
&& apt-get -y install tcpdump \
&& apt-get -y install sqlite sqlite3 libsqlite3-dev \
&& apt-get -y install gsl-bin libgslcblas0 \
&& apt-get -y install libxml2 libxml2-dev \
&& apt-get -y install libgtk2.0-0 libgtk2.0-dev \
&& apt-get -y install vtun lxc \
&& apt -y install git \
&& apt -y install npm \
&& apt-get -y install g++-multilib libc6-dev-i386
devcontainer.json:
{
"name": "802.11ah ns-3 simulation",
"dockerFile": "Dockerfile",
"appPort": 3000,
"extensions": ["dbaeumer.vscode-eslint"],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
}
}
error information: https://i.stack.imgur.com/ZE04I.jpg

You dont have specified the architetture of Ubuntu container in docker file. Apple silicon have ARM architecture, not all image are compatibile.

Related

how to install imagemagick 7 on ubuntu image

I want to install imagemagick v7.
I need the command(s) to add in my Dockerfile.
This command installs v6.9 and this version did not have magick command
RUN apt-get update && apt-get install -y --no-install-recommends imagemagick
can anyone helps me to find how to install imagemagick v7 to have magick command? Thank you very much
RUN apt-get update && apt-get install -y wget && \
apt-get install -y autoconf pkg-config
RUN apt-get update && apt-get install -y wget && \
apt-get install -y build-essential curl libpng-dev && \
wget https://github.com/ImageMagick/ImageMagick/archive/refs/tags/7.1.0-31.tar.gz && \
tar xzf 7.1.0-31.tar.gz && \
rm 7.1.0-31.tar.gz && \
apt-get clean && \
apt-get autoremove
RUN sh ./ImageMagick-7.1.0-31/configure --prefix=/usr/local --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes --with-xml=yes --with-gs-font-dir=yes && \
make -j && make install && ldconfig /usr/local/lib/
you can change the version of you want

Installation issue on my Jenkins Dockerfile : repository not found

I wrote the code of dockerfile so it will be easier to install jenkins with all it dependencies and use it for CICD pipeline(i am using docker on windows 10).
this is my code:
FROM jenkins/jenkins:lts
USER root
VOLUME /var/run/docker.sock
# install necessary packages to run docker
RUN apt-get -qq -y update && apt-get -qq -y install curl \
&& apt-get -qq -y update && apt-get -qq -y install sudo \
&& apt-get -qq -y update && apt-get -qq -y install apt-transport-https ca-certificates curl gnupg2
software-properties-common \
&& apt-get -qq -y update && apt-get -qq -y install gedit \
&& apt-get -qq -y update && apt-get -qq -y install maven 3.6.0 \
&& apt-get -qq -y update && apt-get -qq -y install docker.io \
&& apt-get -qq -y update && apt-get -qq -y install build-essential fakeroot dpkg-dev \
&& apt-get -qq -y update && apt-get -qq -y install libcurl4-openssl-devpi \
My CMD shows this error:"E: The repository 'https://packagecloud.io/github/git-lfs/debian buster Release' does not have a Release file."
You do not need to run apt-get -qq -y update && apt-get -qq -y install after every single installation.
There was also some syntax errors in packages name.
I fixed those.
Here is your Dockerfile after fixing it :
FROM jenkins/jenkins:lts
USER root
VOLUME /var/run/docker.sock
# install necessary packages to run docker
RUN apt-get -y update && apt-get -y install curl \
apt-transport-https ca-certificates curl gnupg2 \
software-properties-common gedit maven docker.io \
build-essential fakeroot dpkg-dev \
libcurl4-openssl-dev
CMD ["sh"] #You do not need this line maybe you have your own default command to run
Then just run the command :
docker build -t <your_docker_username>/<image_name> .
Using Docker build command
docker build -t image_name:image_tag path_to_dockerfile
I hope that this can help you to resolve your issue

Dockerfile Installing Selenium - Ambiguous code

Can someone explain this code to me?
# Installation required for selenium
RUN apt-get update -y \
&& apt-get install --no-install-recommends --no-install-suggests -y tzdata ca-certificates bzip2 curl wget libc-dev libxt6 \
&& apt-get install --no-install-recommends --no-install-suggests -y `apt-cache depends firefox-esr | awk '/Depends:/{print$2}'` \
&& update-ca-certificates \
# Cleanup unnecessary stuff
&& apt-get purge -y --auto-remove \
-o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/* /tmp/*
Why is it necessary to put this in a Dockerfile for selenium to run? (tested and won't run without the code). Why doesn't it simply work by using pip to install the selenium dependency?
Source: Firefox(headless)+selenium cannot access internet from docker container

Docker build returned a non-zero code:1 microsoft/dotnet

MY docker file Code
FROM microsoft/dotnet:2.1-sdk
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get update \
&& apt-get install -y nuget \
&& apt-get install --reinstall make \
&& apt-get install build-essential -y \
&& apt-get install awscli -y \
&& apt-get install jq -y \
&& apt-get install zip -y \
&& apt-get install -y mysql-server \
&& apt-get install -y mono-complete \
&& apt-get install -y libxml-xpath-perl \
&& apt-get install -y nodejs
In step run curl -sL. I'm getting the error,
The command '/bin/sh -c curl -sL https://deb.nodesource.com/setup_8.x | bash - && apt-get update && apt-get install -y nuget && apt-get install --reinstall make && apt-get install build-essential -y && apt-get install awscli -y && apt-get install jq -y && apt-get install zip -y && apt-get install -y mysql-server && apt-get install -y mono-complete && apt-get install -y libxml-xpath-perl && apt-get install -y nodejs' returned a non-zero code: 1
Anybody Know how to fix this error?
Curl is not installed install curl before running a curl command.
FROM microsoft/dotnet:2.1-sdk
RUN apt-get update \
&& apt-get install curl \
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get install -y nuget \
&& apt-get install --reinstall make \
&& apt-get install build-essential -y \
&& apt-get install awscli -y \
&& apt-get install jq -y \
&& apt-get install zip -y \
&& apt-get install -y mysql-server \
&& apt-get install -y mono-complete \
&& apt-get install -y libxml-xpath-perl \
&& apt-get install -y nodejs

Docker 's Error: libselinux conflicts with fakesystemd

I'm building docker image with a Dockerfile:
FROM centos:centos7.1.1503
MAINTAINER foo <foo#bar.com>
ENV TZ "Asia/Shanghai"
ENV TERM xterm
RUN \
yum update -y && \
yum install -y epel-release &&\
yum update -y && \
yum install -y curl wget tar bzip2 unzip vim-enhanced passwd sudo yum-utils hostname net-tools rsync man && \
yum install -y gcc gcc-c++ git make automake cmake patch logrotate python-devel libpng-devel libjpeg-devel && \
yum install -y pwgen python-pip && \
yum clean all
and it show the error as below:
Error: libselinux conflicts with fakesystemd-1-17.el7.centos.noarch
If I change FROM centos:centos7.1.1503 to FROM centos:centos7,all will work fine. So ,what should I do to using centos7.1.1503
My Linux Distribution is Ubuntu 16.04.1 LTS and my docker version is 1.12.6.
Try running this inside the container you create, before any installation is made:
yum swap -y fakesystemd systemd && yum clean all
yum update -y && yum clean all
Or inside a Dockerfile at the begining before the first RUN you have tipped:
RUN yum swap -y fakesystemd systemd && yum clean all \
&& yum update -y && yum clean all
Hope was useful!

Resources