I tried to install java in dockerfile with reference image centos:latest but getting an error:
Step 1/11 : FROM centos:latest
---> 5d0da3dc9764
Step 2/11 : RUN yum -y update
---> Running in 597c6b6cf3f4
CentOS Linux 8 - AppStream 963 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
The command '/bin/sh -c yum -y update' returned a non-zero code: 1
Related
I am getting the following error while building an image
Sending build context to Docker daemon 8.724MB
Step 1/2 : FROM bde2020/spark-worker:2.4.5-hadoop2.7
---> ddb1ab6d9850
Step 2/2 : RUN apt-get update -y
---> Running in 99bbfdabe226
/bin/sh: apt-get: not found
The command '/bin/sh -c apt-get update -y' returned a non-zero code: 127
Here is the docker file
FROM bde2020/spark-worker:2.4.5-hadoop2.7
RUN apt-get update -y
The base OS of that image is Alpine linux. You can verify yourself:
$ docker run --rm -it --entrypoint=cat bde2020/spark-worker:2.4.5-hadoop2.7 /etc/*-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.10.4
PRETTY_NAME="Alpine Linux v3.10"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
cat: can't open '/etc/system-release': No such file or directory
so instead of apt, you want to use apk.
Question :- What Backend does this Error refer to when it states - "because of error 503 Server Error: Backend is unhealthy for URL https://files.pythonhosted.org/packages/....
Am using a Dockerfile for the build. Image was built a few hours back with same Dockerfile. Now getting this ERROR -
Entire trace :
dhankar#dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a2_18/a2___DC_API/aa___Docker_RESTAPI$ sudo docker build -t ddrohit/dck1 .
Sending build context to Docker daemon 1.862MB
Step 1/11 : FROM ubuntu:xenial
---> c9d990395902
Step 2/11 : RUN apt-get update
---> Using cache
---> 42f625ed03cb
Step 3/11 : RUN apt-get install -y python3 # install python3
---> Using cache
---> 393d9e7b20ec
Step 4/11 : RUN apt-get install -y python-pip python-dev build-essential
---> Using cache
---> bb956f271bdd
Step 5/11 : COPY ./ /usr/src/rest_api/
---> Using cache
---> 50d0d52e8e22
Step 6/11 : WORKDIR /usr/src/rest_api/
---> Using cache
---> 42e086f6d8c4
Step 7/11 : RUN pip install --upgrade pip
---> Running in d56c0d5cafce
Collecting pip
HTTP error 503 while getting https://files.pythonhosted.org/packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py2.py3-none-any.whl#sha256=86a60a96d85e329962a9e6f6af612cbc11106293dbc83f119802b5bee9874cf3 (from https://pypi.org/simple/pip/)
Could not install requirement pip from https://files.pythonhosted.org/packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py2.py3-none-any.whl#sha256=86a60a96d85e329962a9e6f6af612cbc11106293dbc83f119802b5bee9874cf3 because of error 503 Server Error: Backend is unhealthy for url: https://files.pythonhosted.org/packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py2.py3-none-any.whl
Could not install requirement pip from https://files.pythonhosted.org/packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py2.py3-none-any.whl#sha256=86a60a96d85e329962a9e6f6af612cbc11106293dbc83f119802b5bee9874cf3 because of HTTP error 503 Server Error: Backend is unhealthy for url: https://files.pythonhosted.org/packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py2.py3-none-any.whl for URL https://files.pythonhosted.org/packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py2.py3-none-any.whl#sha256=86a60a96d85e329962a9e6f6af612cbc11106293dbc83f119802b5bee9874cf3 (from https://pypi.org/simple/pip/)
You are using pip version 8.1.1, however version 10.0.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip install --upgrade pip' returned a non-zero code: 1
dhankar#dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a2_18/a2___DC_API/aa___Docker_RESTAPI$
My Dockerfile :-
#
FROM ubuntu:xenial
RUN apt-get update
RUN apt-get install -y python3 # install python3
RUN apt-get install -y python-pip python-dev build-essential
#
COPY ./ /usr/src/rest_api/
WORKDIR /usr/src/rest_api/
#
RUN pip install -r /usr/src/rest_api/requirements.txt
#
EXPOSE 8000
#
RUN python ./usr/src/rest_api/manage.py migrate
#
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
#
# docker run -p 8888:8000 --name dck1 ddrohit/dck1
#
I am trying to build druid using the docker file provided on the pulsarIO/dockerfiles
But it does not gets build fully and gets stuck at some point:
The Stack looks like this :
shivansh#localhost:~/Documents/Huawei/pulsar/docker-files/pulsarReporting/druid$ sudo sh build
Sending build context to Docker daemon 35.33 kB
Step 1 : FROM ubuntu:14.04
---> 45e5f47e0036
Step 2 : MAINTAINER Xu,Xin <xinxu1#ebay.com>
---> Using cache
---> 46d0ac73c2ed
Step 3 : RUN apt-get update
---> Using cache
---> 7ecac41ee372
Step 4 : RUN apt-get install -y vim less net-tools inetutils-ping curl git telnet nmap socat dnsutils netcat tree htop unzip sudo software-properties-common
---> Using cache
---> be238924e32a
Step 5 : RUN echo 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' > /etc/apt/sources.list.d/java.list && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && apt-get update && echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && apt-get install -y oracle-java7-installer
---> Using cache
---> 7b462d5c7b60
Step 6 : RUN wget -q -O - http://archive.apache.org/dist/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.tar.gz | tar -xzf - -C /usr/local && ln -s /usr/local/apache-maven-3.2.5 /usr/local/apache-maven && ln -s /usr/local/apache-maven/bin/mvn /usr/local/bin/mvn
---> Using cache
---> 8d93a2bebc76
Step 7 : RUN mvn dependency:get -Dartifact=io.druid:druid-services:0.7.3
---> Using cache
---> 1e3fccd70f5b
Step 8 : RUN curl http://static.druid.io/artifacts/releases/druid-0.7.3-bin.tar.gz | tar xz
---> Using cache
---> 73d092b0fc55
Step 9 : RUN mv druid-0.7.3 druid-services
---> Using cache
---> 278eb7e7f30c
Step 10 : RUN apt-get install -y mysql-server && sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
---> Using cache
---> 9864be2ef7ce
Step 11 : ADD config druid-services/config
---> Using cache
---> 4f3d4b4dd1d7
Step 12 : ADD ./mysql.ddl mysql.ddl
---> Using cache
---> 51b798fa62da
Step 13 : RUN mysqld_safe & mysqladmin --wait=5 ping && mysql < mysql.ddl && mysqladmin shutdown
---> Using cache
---> f7ddfd9fbd3e
Step 14 : WORKDIR /druid-services
---> Using cache
---> cc01a554687d
Step 15 : RUN java -classpath "config/_common:lib/*" io.druid.cli.Main tools pull-deps
---> Running in d8a09c205f3d
Oct 25, 2016 7:23:31 AM org.hibernate.validator.internal.util.Version <clinit>
INFO: HV000001: Hibernate Validator 5.1.3.Final
I cannot understand exactly what the problem is ! And If i try to run the
sudo docker ps -a
command to see the running containers I cannot see the druid one there !
Any help is appreciated !
When I am running the build command:
$ docker build -t cowsay .
Sending build context to Docker daemon 3.072 kB
Step 1 : FROM
Unknown instruction: FROM
dev#ub:~/cowsay$ docker build -t cowsay .
Sending build context to Docker daemon 3.072 kB
Step 1 : FROM ubuntu:14.04
---> 90d5884b1ee0
Step 2 : RUN apt-get -y install cowsay
---> Running in 587aaba2824b
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package cowsay
The command '/bin/sh -c apt-get -y install cowsay' returned a non-zero code: 100
Content of Dockerfile is as follow:
FROM ubuntu:14.04
RUN apt-get -y install cowsay
RUN apt-get -y install fortune
ENTRYPOINT ["/usr/games/cowsay"]
CMD ["Docker is so awesomoooooooo!"]
ONBUILD RUN /usr/games/fortune | /usr/games/cowsay
How can I avoid this error message?
Try and add RUN apt-get update first.
Once the packages are updated, you can install, for instance, cowsay.
See for instance this Dockerfile as an example of RUN apt-get commands:
FROM debian:jessie
RUN apt-get update && apt-get install -y cowsay
COPY docker.cow /usr/share/cowsay/cows/docker.cow
ENTRYPOINT ["/usr/games/cowsay","-f","docker"]
CMD ["moby","dock"]
I am trying to install the 'sl' package in my ubuntu:14.04 image. Here's the content of my Dockerfile :
FROM ubuntu:14.04
MAINTAINER xyz <xyz#gmail.com>
RUN echo 'Going to install sl now'
RUN apt-get install -y sl
And this is the command I'm using to build the image:
sudo docker build -t xyz/ubuntu:14.04 .
But I'm getting this error message:
Sending build context to Docker daemon 2.048 kB
Sending build context to Docker daemon
Step 0 : FROM ubuntu:14.04
---> d0955f21bf24
Step 1 : MAINTAINER xyz <xyz#gmail.com>
---> Using cache
---> a6e08926e788
Step 2 : RUN echo 'Going to install sl now'
---> Using cache
---> 1bf0bc6b3092
Step 3 : RUN apt-get install -y sl
---> Running in f7e57167443f
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package sl
INFO[0004] The command [/bin/sh -c apt-get install -y sl] returned a non-zero code: 100
Where am I going wrong?
You need to run apt-get update e.g:
RUN apt-get update && apt-get install -y sl
You can also tidy up after yourself to save a bit of disk space:
RUN apt-get update && apt-get install -y sl && rm -r /var/lib/apt/lists/*
You need to update indices on your local ubuntu repository before installing any other package. The right way to do this will be:
RUN apt-get update
RUN apt-get install -y <package-name>
As Adrian mentioned in his answer deleting the downloaded list can be used to save some space on the disk. This is especially helpful when you are pushing the image back to the hub.