Installation issue on my Jenkins Dockerfile : repository not found - docker

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

Related

Docker Compose: Apt-utils installation problem

I am trying to build a new image in Docker Compose but the following problem occurs
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apt/apt-utils_2.4.7_amd64.deb 404 Not Found [IP: ]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get install -y apt-utils' returned a non-zero code: 100
ERROR: Service 'nginx-service' failed to build : Build failed
In my Dockerfile I'm running: RUN apt-get install -y apt-utils and with --fix-missing.
None of the related questions or other solutions helped me and I've been stuck for quite a while. What am I missing?
Thanks!
EDIT: The whole Dockerfile
FROM ubuntu:latest
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y nginx
RUN apt-get clean
RUN apt-get install -y curl
RUN apt-get install -y unzip
RUN apt-get install -y wget
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
RUN apt-get install -y php php-xml php-curl php-fpm php-mysql
RUN apt-get install -y apt-utils --fix-missing
RUN apt-get install -y php-zip --fix-missing
RUN apt-get install -y php-gd --fix-missing
RUN apt-get install -y mysql-server
RUN curl -sS https://getcomposer.org/installer -o composer-setup.php
RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer
RUN apt-get install -y nano
RUN apt-get install -y mc
RUN apt-get install -y systemctl
RUN systemctl start nginx.service
usually , when we are building a new image, we use update then install like this
RUN apt-get update && apt-get install -y apt-utils
This will update apt source list and will make the package available to install.
Addibg this to your Dockerfile should fix the issue.
If you want to install many at once you can add the packages like the following :
RUN apt-get update && apt-get install -y \
bzr \
cvs \
git \
mercurial \
subversion \
Building the image like this:
docker-compose build --no-cache
worked for me

Issue compiling Dockerfile on MacOS(apple Sillicon)

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.

Dockerfile Ubuntu with interactive install

I'm making this post to you, because I'm currently doing a docker file from a UBUNTU 20.04.
In my dockerfile I run installs which for some require multiple choice questions with "interactive" answer.
So I wanted to know how I could automate the thing.
I leave you attached my docker file, I put a hash in front of the packages causing me problem.
RUN apt-get update
RUN rm -f /etc/localtime && ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime
RUN apt-get install apache2 -y
RUN apt install gnupg
RUN apt-get install wget
RUN cd /tmp
RUN wget https://dev.mysql.com/get/mysql-apt-config_0.8.20-1_all.deb
#RUN apt install ./mysql-apt-config_0.8.20-1_all.deb -y
RUN apt-get install mysql-server -y
RUN apt-get install mysql-client
RUN apt-get install php -y
RUN apt-get install vim -y
RUN apt-get install nano
RUN apt-get install pv
RUN apt-get install php-mysql -y
RUN apt-get install libapache2-mod-php
RUN apt-get install git-core -y
RUN apt-get install unoconv -y
RUN apt-get install poppler-utils
#RUN apt-get install ttf-mscorefonts-installer -y
#RUN apt-get install wkhtmltopdf -y
#RUN apt-get install backup-manager
RUN apt-get install xvfb
RUN apt-get install php-imap -y
RUN apt-get install php-intl -y
#RUN apt-get install php-mcrypt
RUN apt-get install curl
RUN apt-get install php-curl -y
RUN apt-get install openssl
RUN apt-get install ssl-cert
RUN apt-get install php-mbstring -y
RUN apt-get install php-xml -y
RUN apt-get install php-imagick -y
RUN apt-get install php-zip -y
#RUN apt-get install postfix -y```
Thank you for your help ;D
add the following before calling apt-get
ENV DEBIAN_FRONTEND=noninteractive
or prepend DEBIAN_FRONTEND=noninteractive before apt-get command, such as DEBIAN_FRONTEND=noninteractive apt-get install curl -y

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 installation debian openjdk-7-jre

I've been trying to install openjdk-7-jre in a docker image. But when I tried to install it I got the following error:
E: Failed to fetch http://security.debian.org/pool/updates/main/o/openjdk-7/openjdk-7-jre-headless_7u111-2.6.7-2~deb8u1_amd64.deb Connection failed [IP: 200.17.202.197 80]
I've been spending a lot of hours trying this. For More details, the instruction in the Dockerfile is:
RUN apt-get update -qq && apt-get install -y -f xvfb wget
RUN sed -i -re 's/([a-z]{2}\.)?archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list && \
apt-get update -qq && \
apt-get install --fix-missing -y -f openjdk-7-jre
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
dpkg --unpack google-chrome-stable_current_amd64.deb && \
apt-get install -f -y && \
apt-get clean && \
apt-get update && \
rm google-chrome-stable_current_amd64.deb
RUN npm install -g protractor mocha jasmine cucumber && \
webdriver-manager update && \
apt-get update
What am I doing wrong?
This is because you are getting an error in the second RUN command, apt-get update -qq. The error is getting buried because of -qq flag (which will quite the error messages. Try without -qq to diagnoise the error)
You can try using below Dockerfile for installing openjdk-7-jre.
FROM ubuntu
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:openjdk-r/ppa
RUN apt-get update
RUN apt-get install --fix-missing -y -f openjdk-7-jre
just added FROM debian:jessie to your dockerfile and successfully built the image. Your problem is your internet connection, Use VPN or Proxy servers to build the image.

Resources