I am trying to build the following dockerfile
FROM php:8.0-apache
RUN apt-get update
# because apparently composer can shell out to unzip? Who knew...
RUN apt-get install wget unzip zip -y
but it failed with the following error
[root#dev svc]# docker build -t wsb -f Dockerfile .
Sending build context to Docker daemon 17.62 MB
Step 1/11 : FROM php:8.0-apache
---> 97f22a92e1d1
Step 2/11 : RUN apt-get update
---> Using cache
---> ddba6cf13bac
Step 3/11 : RUN apt-get install wget unzip zip -y
---> Running in 6fb3e2f37401
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package wget
E: Unable to locate package unzip
E: Unable to locate package zip
The command '/bin/sh -c apt-get install wget unzip zip -y' returned a non-zero code: 100
Existing contents of sources.list file
# deb http://snapshot.debian.org/archive/debian/20210511T000000Z buster main
deb http://deb.debian.org/debian buster main
# deb http://snapshot.debian.org/archive/debian-security/20210511T000000Z buster/updates main
deb http://security.debian.org/debian-security buster/updates main
# deb http://snapshot.debian.org/archive/debian/20210511T000000Z buster-updates main
deb http://deb.debian.org/debian buster-updates main
I am not sure why it's unable to find. Should I add any URL to /etc/apt/sources.list to get this working?
EDIT
Sending build context to Docker daemon 17.62 MB
Step 1/9 : FROM php:8.0-apache
---> 97f22a92e1d1
Step 2/9 : RUN apt-get update && apt-get install wget unzip zip -y
---> Running in 374b1060dfb3
Err:1 http://security.debian.org/debian-security buster/updates InRelease
Temporary failure resolving 'security.debian.org'
Err:2 http://deb.debian.org/debian buster InRelease
Temporary failure resolving 'deb.debian.org'
Err:3 http://deb.debian.org/debian buster-updates InRelease
Temporary failure resolving 'deb.debian.org'
Reading package lists...
W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease Temporary failure resolving 'security.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease Temporary failure resolving 'deb.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.
You've cached a stale update so apt is trying to install these packages from versions that are no longer in the repositories. This is why Docker's best practices mention to not separate these steps:
FROM php:8.0-apache
RUN apt-get update \
&& apt-get install wget unzip zip -y
From the second issue you are now seeing, you have a networking issue within your containers. There are lots of possible causes, including the host not being connected to the network, and networking changing after the docker engine was started. You'd need to provide a lot more debugging (can you reach these nodes from the host, is DNS working, is there a proxy or firewall on the network, etc).
Related
I have the following Dockerfile
FROM jupyter/scipy-notebook
#RUN apt-get update && apt-get install -y curl
RUN pip install mlflow
RUN pip install sklearn
RUN apt-get update && apt-get install -y curl
When I do
docker build -t mycontainer .
I get
Step 4/4 : RUN apt-get update && apt-get install -y curl
---> Running in 5defd9816a22
Reading package lists...
E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)
The command '/bin/bash -o pipefail -c apt-get update && apt-get install -y curl' returned a non-zero code: 100
I suspect it is something related with not running as a root?
So how can I install curl in my container from the Dockerfile?
EDIT: I applied the answer that I was given.
Unfortunately it did not work
Step 4/7 : USER root
---> Running in aa6a1b7a023f
Removing intermediate container aa6a1b7a023f
---> 59e87b9598b2
Step 5/7 : RUN apt-get update && apt-get install -y curl
---> Running in 4440ce61ebc6
Err:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu focal InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package curl
The command '/bin/bash -o pipefail -c apt-get update && apt-get install -y curl' returned a non-zero code: 100
EDIT2: I tried it in a different network setup and it worked.
You're seeing a "permission denied" error when apt attempts to create /var/lib/apt/lists/partial. This is because your process isn't running as root; the jupyter/scipy-notebook image is configured to run as non-root user (it runs as user jovyan).
You can change the user under which commands run in your Dockerfile with the USER directive, like this:
FROM jupyter/scipy-notebook
RUN pip install mlflow
RUN pip install sklearn
USER root
RUN apt-get update && apt-get install -y curl
USER jovyan
Note that I've made sure to reset the user back to jovyan after running the apt-get command.
Try to install it with root as it done in official jupyter/scipy-notebook Dockerfile and set it back to $NB_UID: (see user declaration in official base docker image)
USER root
# Install packages you need:
RUN apt-get update && apt-get install -y curl
# Switch back to jovyan to avoid accidental container runs as root
USER $NB_UID
Here is the hierarchy of base docker images used by jupyter/scipy-notebook:
jupyter/base-notebook -> jupyter/minimal-notebook -> jupyter/scipy-notebook
I was following the Microsoft [Doc-][1] to run the ADO build agent in Azure Container registry.
When I tried to build the Docker image by the docker file, getting lot of network related issues.
FROM ubuntu:18.04
# To make it easier for build and release pipelines to run apt-get,
# configure apt to not require confirmation (assume the -y argument by default)
ENV DEBIAN_FRONTEND=noninteractive
RUN echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
jq \
git \
iputils-ping \
libcurl4 \
libicu60 \
libunwind8 \
netcat \
libssl1.0 \
&& rm -rf /var/lib/apt/lists/*
RUN curl -LsS https://aka.ms/InstallAzureCLIDeb | bash \
&& rm -rf /var/lib/apt/lists/*
# Can be 'linux-x64', 'linux-arm64', 'linux-arm', 'rhel.6-x64'.
ENV TARGETARCH=linux-x64
WORKDIR /azp
COPY ./start.sh .
RUN chmod +x start.sh
ENTRYPOINT ["./start.sh"]
So I could see there are apt-get update and install commands which are trying for the internet connectivity and getting failed.
---> Running in 456779f71a59
Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Connection failed [IP: 91.189.91.38 80]
Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Connection failed [IP: 91.189.91.39 80]
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Connection failed [IP: 91.189.91.38 80]
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Connection failed [IP: 91.189.91.39 80]
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Connection failed [IP: 91.189.91.39 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Connection failed [IP: 91.189.91.38 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Connection failed [IP: 91.189.91.39 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Connection failed [IP: 91.189.91.38 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
Package ca-certificates is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'ca-certificates' has no installation candidate
E: Unable to locate package curl
E: Unable to locate package jq
E: Unable to locate package git
E: Unable to locate package iputils-ping
E: Unable to locate package libcurl4
E: Unable to locate package libicu60
E: Unable to locate package libunwind8
E: Unable to locate package netcat
E: Unable to locate package libssl1.0
E: Couldn't find any package by glob 'libssl1.0'
E: Couldn't find any package by regex 'libssl1.0'
So looking for a way to create image in offline and will ned to have below list of softwares coupled in it.
Azure CLI
Git 2.30.1
Python2
Python3
OpenJDK 11
OpenJDK 1.8.0
Docker 19.03.13
Helm 3.5.2
Kubectl
NodeJS 10
Maven 3.6.3
jq 1.6
Azure CLI DevOps extension
Configuration for Maven and NPM needs to be done manually.
MAVEN: "~/.m2/settings.xml"
is there any way to do this or Any Microsoft official image available in dockerhub for the selfhosted agent ?
I use a custom dockerfile for my container and i got this error when i try to up my container with docker-compose up -d
Step 4/14 : RUN apt-get update && apt-get install -y libzip-dev wget curl nodejs npm
---> Running in 6007160b4c25
Err:1 http://deb.debian.org/debian bullseye InRelease
Temporary failure resolving 'deb.debian.org'
i test with a dns in /etc/docker/daemon.json
{ "dns" : ["8.8.8.8", "8.8.4.4"]}
but that doesn't work
Due to to partly bad internet in our company we are having issues with building our containers constantly. Lets assume we have our php-fpm container which requires a lot of additional software and has about 60 build steps.
Now when doing docker-compose build --no-cache php-fpm the process quite often quits when e.g. doing apt-get update or installing a certain library.
Output is like this:
Step 29/56 : RUN apt-get update && apt-get -y --no-install-recommends install wkhtmltopdf
---> Running in 7ec583e71349
[...]
Err:1 http://deb.debian.org/debian buster/main amd64 libdouble-conversion1 amd64 3.1.0-3
Could not resolve 'deb.debian.org'
Err:2 http://deb.debian.org/debian buster/main amd64 libpcre2-16-0 amd64 10.32-5
Could not resolve 'deb.debian.org'
[.....]
ERROR: Service 'php-fpm' failed to build: The command '/bin/sh -c apt-get update && apt-get -y --no-install-recommends install wkhtmltopdf' returned a non-zero code: 100
So I wonder if there is a possibility to tell docker to try a step or even certain steps for like three times before quitting the build process?
I'm just following the getting started of docker and I'm a bit lost.
I've create a mydockerbuild folder in my document and a dockerfile with this code (from the tutorial)
FROM docker/whalesay:latest
RUN apt-get -y update && apt-get install -y fortunes
CMD /usr/games/fortune -a | cowsay
Then following the tutorial I run this command:
docker build -t docker-whale .
I got the following error:
Sending build context to Docker daemon 2.048 kB
Step 0 : FROM docker/whalesay:latest
---> fb434121fc77
Step 1 : RUN apt-get -y update && apt-get install -y fortunes
---> Running in dafe01cfcd2b
Err http://archive.ubuntu.com trusty InRelease
Err http://archive.ubuntu.com trusty-updates InRelease
Err http://archive.ubuntu.com trusty-security InRelease
Err http://archive.ubuntu.com trusty Release.gpg
Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com trusty-updates Release.gpg
Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com trusty-security Release.gpg
Could not resolve 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg Could not resolve 'archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
fortune-mod fortunes-min librecode0
Suggested packages:
x11-utils bsdmainutils
The following NEW packages will be installed:
fortune-mod fortunes fortunes-min librecode0
0 upgraded, 4 newly installed, 0 to remove and 3 not upgraded.
Need to get 1961 kB of archives.
After this operation, 4817 kB of additional disk space will be used.
Err http://archive.ubuntu.com/ubuntu/ trusty/main librecode0 amd64 3.6-21
Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com/ubuntu/ trusty/universe fortune-mod amd64 1:1.99.1-7
Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com/ubuntu/ trusty/universe fortunes-min all 1:1.99.1-7
Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com/ubuntu/ trusty/universe fortunes all 1:1.99.1-7
Could not resolve 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/r/recode/librecode0_3.6-21_amd64.deb Could not resolve 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/f/fortune-mod/fortune-mod_1.99.1-7_amd64.deb Could not resolve 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/f/fortune-mod/fortunes-min_1.99.1-7_all.deb Could not resolve 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/f/fortune-mod/fortunes_1.99.1-7_all.deb Could not resolve 'archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get -y update && apt-get install -y fortunes' returned a non-zero code: 100
I think the error come from apt-get update but when I do it on my computer I got no problem.
I'm running ubuntu 14.04
you might try to adjust you update command as per the error message:
Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
So I found the problem, the error is a connectivity issue within the container.
I have found other topic about this problem for people not using a personnal wifi network.
So I just run the command using 3G from my phone and it works.