-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with docker:publishLocal for alpine #1202
Comments
With sbt-native-packager 1.3.17 builds fine |
It doesn't really work (for me) with 1.3.17. Both 1.3.17 and 1.3.18 have their own problems. Details below: I have a Play Framework app I want to containerize using sbt-native-packager.
There are 2 problems with the above.
Now, with the 1.3.18 version, here's the generated Dockerfile:
This image fixes the executable script issues from 1.3.17, but now tries to use a different user for running the processes instead of These are the Docker settings I used in
|
I should note that the documentation does say that the (new) default user is
(emphasis mine) I was able to work around it by adding
to my |
Thanks for all the details and sharing your working Your proposed solution is IMHO the way to go. As you said the There are two options from here.
WDYT? Thanks for your patience. I'm currently on parental leave. |
I would vote on the second option -- make the Here's an attempt at a solution: In the latest if we change this to the following, it should work on both flavors (standard and BusyBox):
This updated command works just like the original one, except it checks if the If neither of these binaries exist, then an error will be thrown by Docker when building the image. What do you think? It's fairly crude, but should work in most cases. |
In case anybody else bumps into this problem, what I did to solve it was to simply install the dockerBaseImage := "adoptopenjdk/openjdk11:x86_64-alpine-jre-11.0.6_10" ,
dockerCommands := dockerCommands.value.flatMap {
case cmd@Cmd("FROM",_) => List(cmd, Cmd("RUN", "apk update && apk add bash && apk add shadow"))
case other => List(other)
}, |
In case anybody else bumps into this problem and does not want to install useradd and bash due to security / size concerns:
and activate the docker / ash shell plugin
No need to install anything else. |
@alexandru Thanks for that code snippet. That mostly worked for me. For some reason, with the latest version of sbt-native-packager (version 1.7.4), none of the commands were matching that first
|
Expected behaviour
Actual behaviour
Information
dockerBaseImage := "java:8-jre-alpine"
sbt-native-packager 1.3.18
sbt version 1.2.8
MacOS
docker
alpine
The text was updated successfully, but these errors were encountered: