As in title, I can not install openjdk-7-jdk using dockerfile from Ubuntu 14.04.
At that command RUN apt-get install -y openjdk-7-jdk I get the following error
Unable to fetch some archives, maybe run apt-get update or try with
--fix-missing?
failed to build: The command '/bin/sh -c apt-get install -y
openjdk-7-jdk' returned a non-zero code: 100
Before I already use RUN apt-get update -y && apt-get upgrade -y and additionally I was trying RUN sudo apt-get -f install. I read that people find a way to do this using Packages in the PPA, but it's not recommended because of the lack of security.
Related
I am using windows os, So there is no issue with Font(java.awt) class object creation. but my testing environment is on linux. So on that I am getting NULL POINTER exception.
Cannot load from short array because "sun.awt.FontConfiguration.head" is null
After seacrhing I found that there should be fonts folder in usr/share directory on linux.
So someone can please suggest. Do I have to just copy fonts to that directory or there is other way to intsall?
For my configuration (java.18/Spring Boot/jib/Docker/ubuntu) I've used this these commands for resolving the issue:
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update -y
RUN apt-get install -y apt-utils --no-install-recommends
RUN apt-get install -y libfreetype6 --no-install-recommends
RUN apt-get install -y fontconfig --no-install-recommends
RUN apt-get install -y fonts-dejavu --no-install-recommends
Below is my Dockerfile
FROM python:3.8-slim-buster
WORKDIR /app
RUN python --version
RUN apt-get install java-1.8.0-openjdk-devel
RUN python -m pip install --upgrade pip
RUN pip install --default-timeout=100 pyspark
I want to install java 8 and set JAVA_HOME variables. But when I am trying to build above image I am getting below error:
E: Unable to locate package java-1.8.0-openjdk-devel
E: Couldn't find any package by glob 'java-1.8.0-openjdk-devel'
E: Couldn't find any package by regex 'java-1.8.0-openjdk-devel'
This is my first attempt in creating a docker image. Please suggest what is wrong with above Dockerfile. I am working on centos7.
Another approach is that you can build your Dockerfile based on FROM ubuntu:20.04 where Python 3.8 is set as default (here). Then, install java and pip later.
FROM ubuntu:20.04
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
RUN apt-get update -y \
&& apt-get install -y software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get install openjdk-8-jdk -y \
&& apt-get install python3-pip -y \
&& export JAVA_HOME \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
I have a python script that need java runtime. I am trying to build a docker image that contains contains both python 3.8 and Java 8. Here is my Dockerfile
FROM python:3.8-slim-buster
RUN apt-get update && apt-get install -y openjdk-8-jre
WORKDIR /
ADD ./requirements.txt /
ADD ./main.py /
RUN pip install -r requirements.txt
CMD [ "python", "./main.py" ]
However I get the following error when building the image
docker.errors.BuildError: The command '/bin/sh -c apt-get update && apt-get install -y openjdk-8-jre' returned a non-zero code: 100
I have tried different python base images but I get the same error. What am I doing wrong?
The package openjdk-8-jre is not available in Debian Buster repositories. The command :
RUN apt-get update && apt-get install -y openjdk-8-jre
returns :
[...]
E: Unable to locate package openjdk-8-jre
The command '/bin/sh -c apt-get update && apt-get install -y openjdk-8-jre' returned a non-zero code: 100
You have 2 options :
install a newer version of JRE (openjdk-11-jre) if you can
install OpenJDK 8 by downloading it manually : follow this guide https://linuxize.com/post/install-java-on-debian-10/
I have a docker file like below.
FROM ubuntu
FROM python:3.6
RUN apt-get update --fix-missing
RUN apt-get install wget curl software-properties-common -y
RUN apt-get install g++ gcc mercurial -y
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/oracle-jdk8-installer;
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
RUN export JAVA_HOME
When i try to build the docker using sudo docker build -t test_dock . command, there is an error saying
Unable to locate jdk package
So i have added
RUN add-apt-repository ppa:openjdk-r/ppa
before jdk installation command.
Now the build errors out saying
E: The repository 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu focal
Release' does not have a Release file.
What is the correct way to install jdk in ubuntu docker?
For me solved by replacing :
FROM ubuntu
FROM python:3.6
To:
FROM python:3-stretch
I would like a Docker Postgres container with Java.
Here my Dockerfile:
FROM postgres AS postgres
FROM openjdk
COPY --from=postgres . .
I don't get any errors. But when I execute java -version it says
command not found
I also tried this:
FROM postgres
RUN apt-get update -y
RUN apt-get install -y oracle-java8-installer
But I get the error
Package oracle-java8-installer is not available, but is referred to by another package.
What did I do wrong? How do I accomplish this?
I accomplished it with following Dockerfile:
FROM postgres
RUN apt-get update -y
RUN apt-get install -y default-jre-headless