Skip to content

Instantly share code, notes, and snippets.

@teekaay
Created February 24, 2017 18:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save teekaay/39bff8c66cd8e43c2ba57a6b2eef4fa8 to your computer and use it in GitHub Desktop.
Save teekaay/39bff8c66cd8e43c2ba57a6b2eef4fa8 to your computer and use it in GitHub Desktop.
Dockerfile for installing Java with Ubuntu base image
# Java 8 (Oracle) Dockerfile
# Base image: Ubuntu
# Installs: Java 8
FROM ubuntu:latest
# Install basic software support
RUN apt-get update && \
apt-get install --yes software-properties-common
# Add the JDK 8 and accept licenses (mandatory)
RUN add-apt-repository ppa:webupd8team/java && \
echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections
# Install Java 8
RUN apt-get update && \
apt-get --yes --no-install-recommends install oracle-java8-installer
# Jetty/Tomcat port
# EXPOSE 8080
# === Do your work here ===
@taoli-ax
Copy link

E: Package 'oracle-java8-installer' has no installation candidate

@ashutoshikade
Copy link

ashutoshikade commented Dec 29, 2022

E: Unable to locate package software-properties-common

edit: after running apt-get update before apt-get install, I was able to install software-properties-common

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment