I am trying to create a docker image but getting error. it's failing on RUN apt-get update. code sample is given below.
# Update packages
RUN apt-get update
RUN apt-get install -y --no-install-recommends software-properties-common make g++
RUN apt-get install -y sudo
RUN apt-get install -y curl
RUN apt-get install -y git
Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification.
I am also tried to put below code but facing same issue.
sudo apt-get clean
sudo apt-get install -y ca-certificates
sudo update-ca-certificates
sudo apt-get update
Anyone can help on this.
Related
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
I am trying to install windows defender in a docker container.
But Facing the following error while Docker Build.
System has not been booted with systemd as init system (PID 1). Can't
operate. Failed to connect to bus: Host is down
Docker File :
FROM openjdk:11
RUN apt-get -y update
RUN apt-get -y install curl
RUN curl -o microsoft.list https://packages.microsoft.com/config/debian/10/prod.list
RUN mv ./microsoft.list /etc/apt/sources.list.d/microsoft-prod.list
RUN apt-get install -y gpg
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN apt-get install apt-transport-https
RUN apt-get -y update
RUN apt-get install -y systemd
RUN apt-get install -y mdatp
This is for an Airflow project, and we're starting with this Dockerfile, which itself seems to start with the debian:buster-slim image.
This post suggested to run the following:
sudo apt install dirmngr gnupg apt-transport-https software-properties-common ca-certificates curl
curl -fsSL https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
sudo add-apt-repository 'deb https://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main'
sudo apt update
sudo apt install mongodb-org
however when we add RUN apt install dirmngr gnupg apt-transport-https software-properties-common ca-certificates curl to the Dockerfile, we get the errors:
E: Unable to locate package dirmngr
E: Package 'gnupg' has no installation candidate
E: Unable to locate package software-properties-common
What should we add to this Dockerfile in order to properly install mongodb to be able to use mongoimport command?
Seems like the following is doing the trick:
RUN apt-get update && apt-get install -y gnupg software-properties-common
RUN curl -fsSL https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add -
RUN add-apt-repository 'deb https://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main'
RUN apt-get update
RUN apt-get install -y mongodb-org
RUN mongo --version
RUN mongoimport --version
Last 2 lines to test that the first 5 lines worked. Initially ran into issues installing gnupg and software-properties-common but the -y flag and the apt-get update beforehand helped. Everything seems good so far with this.
I'm trying to run my Dockerfile script and I'm facing this error:
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/c/curl/curl_7.47.0-1ubuntu2.9_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Unable to fetch some archives, may be run apt-get update or try with --fix-missing?
This happens at line
RUN apt-get install curl
I tried doing : RUN apt-get update && apt-get install curl but I had then faced this:
"After this operation, 339 kB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.
The command /bin/sh -c apt-get update && apt-get install curl returned a non-zero code: 1
"
Any ideas?
You want apt-get -y install curl. The -y causes apt to proceed without prompting for confirmation.
This should help:
RUN apt-get clean && apt-get -y update && apt-get install -y curl
I have installed docker on windows 10 pro. I am facing an issue while running the following command in git-bash.
docker-compose up -d --build
and got following error.
E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation
(23) Failed writing body
Error executing command, exiting
ERROR: Service 'web' failed to build: The command '/bin/sh -c curl -sL https://deb.nodesource.com/setup_8.x | bash' returned a non-zero code: 1
In your Dockerfile, run this first:
apt-get update && apt-get install -y gnupg2
or
apt-get update && apt-get install -y gnupg
I faced the same issue:
E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation
I resolved by using the following commands:
apt-get update
apt-get install gnupg
In addition to existing answers:
RUN apt-get update && apt-get install -y gnupg
-y flag agrees to terms during installation process. It is important not to break the build
Just install the updated versions of all of them.
apt-get install -y gnupg2 gnupg gnupg1
I have debian 9 and to fix this i used the new library as follows:
ln -s /usr/bin/gpgv /usr/bin/gnupg2