-
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
docker image from sbt docker:publishLocal
fails with "Failed to create parent directories for [/opt/docker/./logs/application.json]"
#1361
Comments
Thanks @briancaffey for your question. This is docker + logback configuration issue. Docker containers are isolated. If you try to access a path on the filesystem, as logback tries to do with the file appender
or the play framework with the pid file
and you haven't mounted a volume where the running docker image can access these file, you'll get the errors you see. For play this is a year standing issue. You can disable the pid file by following this documentation ("Play PID Configuration")f |
Thank you @muuki88 I'll try working through this with your suggestions. |
@briancaffey did you find a solution to this? i tried following the linked section above but same result :( |
1 similar comment
@briancaffey did you find a solution to this? i tried following the linked section above but same result :( |
See customize runtime parameters and in your Universal / javaOptions ++= Seq(
// don't write any pid files
-Dpidfile.path=/dev/null,
// reference a logback config file that has no file appenders
-Dlogback.configurationFile=logback-prod.xml
) Example of a logback config with no file appenders <configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="STDOUT" />
</root>
</configuration> |
You can manually create folders inside docker? dockerCommands ++= Seq(
// Optional step - declare folders for logs if not mounted to the host
ExecCmd("RUN", "mkdir", "-p", "/opt/docker/logs/"),
ExecCmd("RUN", "chmod", "+w", "-R", "/opt/docker/logs/")
) |
Expected behaviour
A docker image built by
sbt docker:publishLocal
fails to run succesfully.Actual behaviour
sbt docker:publishLocal
creates a docker image, but that image fails with the following:Information
Ubuntu 18.04
docker image from
sbt docker:publishLocal
Error Logs
sbt docker:publishLocal
creates an image locally:When I try to run this image with
I get the following errors:
Also, here is the result of
sbt docker:stage
:The text was updated successfully, but these errors were encountered: