Docker
Concepts
Dockerfile
# file: Dockerfile
Docker Compose
Need an OS with Java installed - One such image is amazoncorretto amazoncorretto - different images for same java version based on feature included
- alpine :
# file: docker-compose.yml
FROM amazoncorretto:21.0.2-alpine3.19 # Base image to provide os and jdk
COPY build/libs/my-app.jar app.jar # copy the jar to root of the OS
ENTRYPOINT ["java","-jar","/app.jar"] # java -jar build/libs/app.jar
docker build -t a04t/imagename:v01 . # intel
docker build --platform linux/amd64 -t a04t/imagename:v01 . # mac chips
Package Managers in base images
- There are several Linux distributions and the different ways they manage packages.
- Knowing how to use multiple package managers can prove life-saving for downloading or installing software from repositories, plus updating, handling dependencies and uninstalling software.
- Example - Dockerfile with `` will have apt package available which can be explored here
- 5 Best Linux Package Managers for Linux Newbies
FROM gradle:5.6.2-jdk11
RUN apt-get update && apt-get install -y bash git curl zip unzip locales