Unable to build docker container - docker

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

Related

Certificate verification failed. While docker image build in nodejs

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.

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

Problems installing msodbcsql17 with Docker

I have a dockerfile to upload some python code on Azure. It has been working for a few months, but today it suddenly stopped working.
The relevant commands in the Dockerfile are:
FROM python:3.9.5
:
:
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN exit
RUN apt-get update && ACCEPT_EULA=Y apt-get install msodbcsql17
The error message is that appeared today is:
Err:1 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 msodbcsql17 amd64 17.7.2.1-1
404 Not Found [IP: 104.214.230.139 443]
E: Failed to fetch https://packages.microsoft.com/ubuntu/20.04/prod/pool/main/m/msodbcsql17/msodbcsql17_17.7.2.1-1_amd64.deb 404 Not Found [IP: 104.214.230.139 443]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get update && ACCEPT_EULA=Y apt-get install msodbcsql17' returned a non-zero code: 100
2021/06/16 20:50:56 Container failed during run: build. No retries remaining.
failed to run step ID: build: exit status 100
I believe this might be related to the .deb files being moved - or that some computer at Microsoft is down?
A good workaround would maybe be to download the relevant msodbcsql17 package directly, but I was unable to find this package in the normal repos?
There seems to be some ongoing trouble with microsoft repos for some linux distributions (including ubuntu and debian). Not clear when this will be fixed.
https://github.com/dotnet/core/issues/6381
https://github.com/MicrosoftDocs/sql-docs/issues/6494
The answer might be related to this post:
https://github.com/dotnet/core/issues/6381
It seems that some Ubuntu repositories are broken.
Hopefully it will be fixed soon...
I Will keep an eye on the resolve, but I have the same issue using:
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17
# optional: for bcp and sqlcmd
RUN ACCEPT_EULA=Y apt-get install -y mssql-tools
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
# optional: for unixODBC development headers
RUN apt-get install -y unixodbc-dev

E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation

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

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