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.
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 build an extension of an existing image with FROM and then apt install additional packages on top and do own customizations. I get permission denied and "are you root" messages. Specifically, this is the image I want to extend:
https://hub.docker.com/r/makarius/isabelle
My Dockerfile:
FROM makarius/isabelle:latest
SHELL ["/bin/bash", "-c"]
# Add dependencies
RUN apt-get update && \
apt-get install --yes build-essential && \
apt-get install --yes openjdk-8-jdk && \
apt-get install --yes xterm && \
apt-get install --yes iputils-ping && \
apt-get install --yes vim && \
apt-get install --yes net-tools && \
apt-get -y install xauth && \
apt-get clean
# user
RUN useradd -m foo && (echo foo:foo | chpasswd)
USER foo
# Setup FOO repository
WORKDIR /home/foo
# ... some commands
ENTRYPOINT ["/bin/bash"]
Building it it seems I can't get the ability to install anything. There is no sudo in the image.
root#ub18:/home/x/foo/bar# sudo docker build -t i8:01 -f Dockerfile .
Sending build context to Docker daemon 408.7MB
Step 1/9 : FROM makarius/isabelle:latest
---> da948b0dd494
Step 2/9 : SHELL ["/bin/bash", "-c"]
---> Using cache
---> 64f897ae98ea
Step 3/9 : RUN apt-get update && apt-get install --yes build-essential && apt-get install --yes openjdk-8-jdk && apt-get install --yes xterm && apt-get install --yes iputils-ping && apt-get install --yes vim && apt-get install --yes net-tools && apt-get -y install xauth && apt-get clean
---> Running in 9ec12ecb98e8
Reading package lists...
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
The command '/bin/bash -c apt-get update && apt-get install --yes build-essential && apt-get install --yes openjdk-8-jdk && apt-get install --yes xterm && apt-get install --yes iputils-ping && apt-get install --yes vim && apt-get install --yes net-tools && apt-get -y install xauth && apt-get clean' returned a non-zero code: 100
I expect to be able to build the extended image from the existing one, with two users defined and all packages installed. I can get by with a single user as well if have to.
The parent image markarius/isabelle switched user to isabelle, you gotta switch it back to root to run apt-get with additional line USER root before that line in your docker file. There's no need to use sudo in docker images since by default you already have root access.
I'm having an issue adding Microsoft package list to apt-get in my Dockerfile running on my M1 macbook pro. I was able to run this on my old windows laptop, but now on my mac, I get the Unable to locate package msodbcsql17 error. Just as a sanity check I also tried installing mssql-tools first, but that package was not found as well, so it seems like the entire process of adding these packages to apt-get is failing. Is there something I can do in order to get this to work for both m1 mac and machines using classic architecture?
FROM python:3.7
WORKDIR /app/repo
RUN mkdir /app/docker_volume
RUN apt-get update \
&& apt-get install unixodbc -y \
&& apt-get install unixodbc-dev -y \
&& apt-get install freetds-dev -y \
&& apt-get install freetds-bin -y \
&& apt-get install tdsodbc -y \
&& apt-get install --reinstall build-essential -y
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17
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
RUN /bin/bash -c "source ~/.bashrc"```
The package list grabbed by the curl command references the architecture of your system, and as there are no mssql-tools or msodbcsql17 packages for arm64 architecture at the moment, I was getting the unable to locate error. Current solution is changing the first line of the Dockerfile to specify the platform with FROM --platform=linux/amd64 python:3.7
I have this Dockerfile:
FROM debian:latest
RUN apt-get update &&
apt-get -y install curl &&
apt-get install -y apt-transport-https
RUN curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.deb.sh | bash
RUN apt-get -qq -y install sysbench git make gcc unzip wget lua5.1 lua5.1-dev &&
apt-get clean
RUN wget https://luarocks.org/releases/luarocks-2.4.3.tar.gz && tar zxpf luarocks-2.4.3.tar.gz && cd luarocks-2.4.3 && ./configure && make bootstrap
And when I try to create the image with it, at some point of the process I get this error:
Step 5/6 : RUN apt-get -qq -y install sysbench git make gcc unzip wget lua5.1 lua5.1-dev && apt-get clean
—> Running in 4787766a3d2c
E: Unable to locate package sysbench
The command ‘/bin/sh -c apt-get -qq -y install sysbench git make gcc unzip wget lua5.1 lua5.1-dev && apt-get clean’ returned a non-zero code: 100
Anyone knows where the problem could be?
Thanks
There is a reported bug about sysbench on aarch, ( which is the target arm processor that rpi uses).
Try to follow the suggestion in:
https://github.com/akopytov/sysbench/issues/298
I have written a dockerfile for creating selenium image with debian base image
While I am installing JDK11,I am seeing these errors.
RUN apt-get upgrade
RUN apt-get update
RUN apt-get -y install apt-transport-https curl
RUN apt-get -qqy --no-install-recommends install bzip2
RUN apt-get -qqy --no-install-recommends install ca-certificates
RUN mkdir -p /usr/share/man/man1
RUN apt-get -qqy --no-install-recommends install openjdk-11-jre-headless
RUN apt-get -qqy --no-install-recommends install ca-certificates-java
RUN dpkg --list | grep java
RUN apt-get -qqy --no-install-recommends install sudo
RUN apt-get -qqy --no-install-recommends install unzip
RUN apt-get -qqy --no-install-recommends install gdebi-core
COPY files/chrome/google-chrome_amd64.deb /google-chrome_amd64.deb
RUN gdebi --n /google-chrome_amd64.deb
RUN apt-get -qqy install xvfb
RUN rm -rf /var/lib/apt/lists/* /var/cache/apt/*
RUN echo $(ls ./usr/lib/jvm/java-11-openjdk-amd64/lib/security)
This is the docker file i am using
It's some layering issue I read somewhere else online. Don't know much about that. But that pointed me toward a usable fix: remove the folder and recreate it.
rmdir /etc/ssl/certs/java
mkdir /etc/ssl/certs/java
Now the install should work.