I am trying to install java 8 through oracle-java8-installer on a debian:jessie docker container. The following is my Dockerfile:
FROM debian:jessie
ENV JAVA_VERSION 1.8.0
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" > /etc/apt/sources.list.d/webupd8team-java.list
RUN echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" >> /etc/apt/sources.list.d/webupd8team-java.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
RUN echo "debconf shared/accepted-oracle-license-v1-1 select true" | /usr/bin/debconf-set-selections
RUN apt-get update
RUN apt-get install -y --force-yes vim
RUN apt-get install -y --force-yes oracle-java8-installer
Yet this gives:
Connecting to download.oracle.com (download.oracle.com)|23.63.224.171|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-01-17 12:31:05 ERROR 404: Not Found.
download failed
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)
The command '/bin/sh -c apt-get install -y --force-yes oracle-java8-installer' returned a non-zero code: 100
I have found many similar issues described online, but none of the proposed solutions worked for me. Any idea?
Found the solution on https://hub.docker.com/r/anapsix/docker-oracle-java8/~/dockerfile/:
## JAVA INSTALLATION
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" > /etc/apt/sources.list.d/webupd8team-java-trusty.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes --no-install-recommends oracle-java8-installer && apt-get clean all
The "secret sauce" you were looking for is the first line:
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
Re to donhector's response and your question: you need to replace the strings in the installer file, instead of yours last command:
apt-get install -y --force-yes oracle-java8-installer
run these commands:
apt-get -y install oracle-java8-installer || true
cd /var/lib/dpkg/info
sed -i 's|JAVA_VERSION=8u151|JAVA_VERSION=8u162|' oracle-java8-installer.*
sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/|' oracle-java8-installer.*
sed -i 's|SHA256SUM_TGZ="c78200ce409367b296ec39be4427f020e2c585470c4eed01021feada576f027f"|SHA256SUM_TGZ="68ec82d47fd9c2b8eb84225b6db398a72008285fafc98631b1ff8d2229680257"|' oracle-java8-installer.*
sed -i 's|J_DIR=jdk1.8.0_151|J_DIR=jdk1.8.0_162|' oracle-java8-installer.*
apt-get install -f -y
apt-get install -y oracle-java8-set-default
I have them in a separate script and run it as
RUN /bin/sh /path/to/script.sh
or you can run them directly from your Dockerfile, that's up to you.
You are installing from the webupd8 PPA repo. If you notice, the Java 8 package in that repo points to Java 8 version 151. That package pulls the binary for 151 from the Oracle servers (since Java Oracle licence does not allow anyone else hosting the binaries). Oracle released version 161 a couple days back and apparently moved or removed 151 from their servers. So basically the package in the webupd8 PPA repo is trying to download the 151 binary which no longer exists at the location that the webupd8 package expects it (hence the 404 you got). The webupd8 PPA repo maintainer will have to release a new package pointing to the new 161 binaries from Oracle. Docker or Debian don't play any role in the issue, it is just basically a broken link issue.
Until then you could apply a "workaround" like the one mentioned here: JDK 8 is NOT installed - ERROR 404: Not Found
Here's the list of Java packages in the webupd8 repo:
https://launchpad.net/~webupd8team/+archive/ubuntu/java/+packages
See dpkg oracle Jdk error while installing cassandra in Ubuntu 16.04. This issue is occurring for everyone using install scripts of any kind.
** Java 11:
RUN apt-get install wget java-common gnupg2 -y
RUN echo "oracle-java11-installer shared/accepted-oracle-license-v1-2 select true" | debconf-set-selections
RUN echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main" | tee /etc/apt/sources.list.d/linuxuprising-java.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends oracle-java11-installer && apt-get clean all
Related
I'm trying to follow the official documentation.
However, when I run the command sudo apt-get install docker-ce docker-ce-cli containerd.io
I get the following message:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package docker-ce 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 'docker-ce' has no installation candidate
E: Unable to locate package docker-ce-cli
E: Unable to locate package containerd.io
E: Couldn't find any package by glob 'containerd.io'
E: Couldn't find any package by regex 'containerd.io'
Also, when running apt-cache madison docker-ce, nothing shows up in the terminal...
1. Update APT:
sudo apt-get update
2. Install these packages first:
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
3. Add GPG keys:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
4. Then add Docker repository:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
5. Update again:
sudo apt-get update
6. Install docker-ce, cli and containerd.io:
sudo apt-get install docker-ce docker-ce-cli containerd.io
must work - be sure to execute all commands as root or with sudo.
You can also use their script to automate everything:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo ./get-docker.sh
use curl https://get.docker.com/ | bash - this is an automated script that will work in most of the cases
Install docker is pretty straightforward:
sudo apt install docker.io
I'm running a command that worked until yesterday, and works locally on my local Docker, to install gcsfuse version 0.28.1:
E: Version '0.28.1' for 'gcsfuse' was not found
I tried it on the google cloud console too, and got the same error there.
Any suggestions or pointers?
Here's the original command:
export GCSFUSE_REPO=gcsfuse-lsb_release -c -s
&& echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | tee /etc/apt/sources.list.d/gcsfuse.list
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
&& apt-get update && apt-get install -y gcsfuse=0.28.1 \
I tried the below commands on Google Cloud Shell as per this document reference and I was able to install GCSFuse successfully.
Add the gcsfuse distribution URL as a package source and import its public key using :
export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`
echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
Update the list of packages available and install gcsfuse using :
sudo apt-get update
sudo apt-get install gcsfuse
(Ubuntu before wily only) Add yourself to the fuse group, then log out and back in using :
sudo usermod -a -G fuse $USER
exit
I also found a line in this document which says “The following instructions set up apt-get to see updates to gcsfuse, and are supported for the bionic, artful, zesty, yakkety, xenial, and trusty releases of Ubuntu, and the jessie and stretch releases of Debian. (Run lsb_release -c to find your release codename.) Users of older releases should follow the instructions for other distributions below.
So you should also try and find the release codename first. If you are a user of an older release then these commands might not work for you. For that, follow the instructions/commands of installing older distributions, which is clearly differentiated and specified in this document link
I am not sure if it was your formatting but it looks like it was missing the release variable in your commands. Please try with the commands below:
export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s` && \
echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | tee /etc/apt/sources.list.d/gcsfuse.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
apt-get update -y && \
apt-get install -y gcsfuse=0.28.1 -V
If it does not work, here is the repo with all gcsfuse releases:
https://github.com/GoogleCloudPlatform/gcsfuse/releases/tag/v0.28.1
Whilst the particular base linux docker image we use currently escapes me, the problem I have is I need to include the Postgresql Client.
apt-get update allowed me to install it, but I discovered it was only version 9, and I needed 10 to match my Postgres DB.
If the docker is running and I used exec bash to access it I can run the following commands to install version 10...
echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" >> /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
apt-get update
apt-get -y install postgresql-client-10
So I then set about adding these to my Dockerfile so it would be included automatically, the result being...
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" >> /etc/apt/sources.list.d/pgdg.list
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN apt-get update
RUN apt-get -y install postgresql-client-10
When Visual Studio (Mac 2019) builds the docker, it completely ignores this. When I built it from the command line, the output suggested it had done as it should, what Docker Cloud builds it I get the error...
Step 17/24 : COPY --from=publish /app .
---> 091e71bd17c0
Step 18/24 : RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" >> /etc/apt/sources.list.d/pgdg.list
---> Running in 8582e2dba910
/bin/sh: can't create /etc/apt/sources.list.d/pgdg.list: nonexistent directory
Removing intermediate container 8582e2dba910
The command '/bin/sh -c echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' returned a non-zero code: 1
Note the 3rd line up about can't create pgdg.list
So how should I go about doing this?
Your approach with the additional Dockerfile statements is sound. However, it's unclear how you're extending your previous container image to include these.
Usually you'd have something of the form:
FROM my-original-image:its-version
RUN ...
RUN ...
RUN apt-get update
RUN apt-get -y install postgresql-client-10
This approach would add postgresql-client-10 to whatever's installed in my-original-image:its-version.
An alternative approach is to start from the base from which my-original-image:its-version uses and install postgresql-client-10 instead of the previous version. Your choice.
If my-original-image were created using:
FROM some-base
RUN apt update && apt install -y postgresql-client-9
You could:
FROM some-base
RUN apt update && apt install -y postgresql-client-10
NB You'd have to duplicate the installation of other dependencies too.
Update
See instructions for Dockerizing Postgres here. The Postgres PGP key has possibly been dropped from your image and is causing errors.
FROM debian:stretch-slim
RUN apt-get update && apt-get install -y \
gnupg2 \
wget \
&& apt-key adv \
--keyserver hkp://p80.pool.sks-keyservers.net:80 \
--recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" \
>> /etc/apt/sources.list.d/pgdg.list \
&& wget \
--quiet \
--output-document - \
https://www.postgresql.org/media/keys/ACCC4CF8.asc \
| apt-key add - \
&& apt-get update \
&& apt-get install -y \
postgresql-client-10 \
&& rm -rf /var/lib/apt/lists/*
I am building an image from a Dockerfile that needs to install the package rti-connext-dds-5.3.1. (It's one of the dependencies when building ROS2 on Linux).
The problem with that package is that it displays a license agreement that must be scrolled-down and then accepted by entering "yes" on the prompt. I cannot seem to set up the Dockerfile commands to auto-scroll and/or auto-accept this license agreement:
Pressing the Enter or Space key does not scroll the license down, it just displays blank lines. Pressing any other key/s just prints it out to the console. At this point, the build is stuck, and it can't proceed.
Here is the Dockerfile:
FROM ubuntu:bionic
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y apt-utils debconf-utils gnupg2 lsb-release && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116 && \
echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros2-latest.list && \
apt-get update && \
apt-get install -y rti-connext-dds-5.3.1
WORKDIR /home
I already tried:
Setting DEBIAN_FRONTEND=noninteractive different ways based on the answers from Is it possible to answer dialog questions when installing under docker?
Setting DEBIAN_FRONTEND=teletype based on How to accept license agreement during docker build?
Using debconf-set-selections based on apt-get install without debconf prompt
# echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
# echo "rti-connext-dds-5.3.1 rti-connext-dds-5.3.1/license string y" | debconf-set-selections && \
# echo "rti-connext-dds-5.3.1 rti-connext-dds-5.3.1/license string yes" | debconf-set-selections && \
Piping the yes command (this is worse, as I can't even abort with Ctrl+C)
# apt-get install -y -q rti-connext-dds-5.3.1
# yes "yes" | apt-get install -y -q rti-connext-dds-5.3.1
How do I auto-scroll and/or auto-accept the license during installation?
You can use the env variable "RTI_NC_LICENSE_ACCEPTED=yes". Your dockerfile will look something like this:
FROM ubuntu:bionic
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y apt-utils debconf-utils gnupg2 lsb-release && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116 && \
echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros2-latest.list && \
apt-get update
RUN RTI_NC_LICENSE_ACCEPTED=yes apt-get install rti-connext-dds-5.3.1
WORKDIR /home
This is a valid answer but def not the best one. I'm currently using the trial version of DDS which does NOT allow you to automatically accept the license. So my work around was to do the following:
First I installed the expect command which allows you to write scripts that will interact and say hit enter 21 times and then the letter y etc.
Additionally there is a command called autoexpect that will generate a script for you. So my steps are:
Launch a basic container and copy over rti_connext_dds-6.0.1-eval-x64Linux4gcc7.3.0.run - or mount the file locally
Run autoexpect ./rti_connext_dds-6.0.1-eval-x64Linux4gcc7.3.0.run which will generate script1.exp.
Now build an actual container that copies over the install file as well as the expect script and do the following:
ARG RTI_INSTALL_FILE=rti_connext_dds-6.0.1-eval-x64Linux4gcc7.3.0.run
RUN chmod +x /rti/${RTI_INSTALL_FILE} && expect /rti/script.exp
The best path - of course - is to do what was suggested above - however - to know more about docker expect is a great little hack
All new to docker, i'm trying to build an image of a software, during the
RUN apt-get install -y xxx command i'm encourtering issues :
Setting up lvm2 (2.02.95-8) ...
Setting up LVM Volume Groups... /dev/mapper/control: open failed:Operation not permitted
Failure to communicate with kernel device-mapper driver.
Check that device-mapper is available in the kernel.
No volume groups found
/dev/mapper/control: open failed: Operation not permitted
Failure to communicate with kernel device-mapper driver.
Check that device-mapper is available in the kernel.
No volume groups found
what could cause this issue ?
my distrib is a Debian7, maybe should i try this on a more recent distros ?
here is the Dockerfile :
#installation d'hynesim
FROM debian:wheezy
RUN echo $(whoami)
RUN echo "exit 0" > /usr/sbin/policy-rc.d
RUN apt-get update && apt-get install -y curl
RUN echo 'deb [arch=amd64] http://repository.hynesim.org/debian wheezy 2.2 backports' >> /etc/apt/sources.list && \
echo 'deb-src [arch=amd64] http://repository.hynesim.org/debian wheezy 2.2 backports' >> /etc/apt/sources.list
RUN curl -o - https://repository.hynesim.org/debian/hynesim.asc | apt-key add - && apt-get update && apt-get install -y \
hynesim-node \
hynesim-glacier