Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set base image for DockerPlugin of sbt native packager?

I want to dockerify a scala application.

I use the sbt-native-packager, and when building the image locally via

sbt docker:publishLocal

I was surprised to realize that it would use:

openjdk:latest

as its base image.

I like to point my docker image against certain version, and I know that my application currently require Java 8 and will crash on Java 9; and the latest tag might point to a new major version in the future.

I am a bit confused on how the Docker plugin works through sbt-native-packager. Why is it using openjdk:latest as its base? How can I set it to something different, e.g.: openjdk/8-jdk?

like image 382
k0pernikus Avatar asked Nov 26 '25 09:11

k0pernikus


1 Answers

You can set the baseImage and its tag in your build.sbt through:

dockerBaseImage := "openjdk:8-jdk"

You can read about this in the docker documentation of the sbt native packager.

like image 66
k0pernikus Avatar answered Nov 27 '25 23:11

k0pernikus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!