Search code examples
sbtsbt-native-packager

How to set docker image name using sbt-native-packager


I'm working on multi-module project in Lagom framework and building it using SBT. I successfully configured my project to generate docker images using sbt-native-packager. The only problem I have is that those images have 'funny' names (e.g.: 'brave_meninsky', 'loving_archimedes', 'vigilant_ride' etc.) and I would like to name them differently.

How can I set custom docker image name using sbt-native-packager?

I was unable to find the answer in the docs.

I use the following versions:

SBT: 0.13.13

scala: 2.11.8

sbt-native-packager: 1.2.0-M9


Solution

  • The documentation says to set the packageName in the Docker scope to change the image name.

    However, the examples you give seem to be container names. To set the name of a container when using docker run, use the --name flag:

    docker run --name a_better_name my_image_name:tag