Skip to content
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 - Setting Daemon user fails - not in right order #530

Closed
nightwolfzor opened this issue Mar 25, 2015 · 4 comments
Closed

Docker - Setting Daemon user fails - not in right order #530

nightwolfzor opened this issue Mar 25, 2015 · 4 comments
Labels

Comments

@nightwolfzor
Copy link

I'm trying to create a Docker image, I have a simple build.sbt file;

enablePlugins(JavaAppPackaging)

enablePlugins(DockerPlugin)

maintainer in Docker := "Blah <blah@blah.com>"

daemonUser in Docker := "chotbi"

dockerExposedPorts := Seq(4800)

dockerExposedVolumes := Seq("/opt/docker/logs")

However the docker build fails (using docker v1.5, sbt 0.13.8, packager 1.0.0-RC1) with

[info] Step 4 : RUN chown -R chotbi:chotbi .
[info]  ---> Running in 663be3a5e5f3
[info] chown: invalid user: 'chotbi:chotbi'

Its not to hard to see why looking at the resulting docker file;

FROM dockerfile/java:latest
MAINTAINER Blah <blah@blah.com>
WORKDIR /opt/docker
ADD opt /opt
RUN ["chown", "-R", "chotbi:chotbi", "."]
EXPOSE 4800
RUN ["mkdir", "-p", "/opt/docker/logs"]
RUN ["chown", "-R", "chotbi:chotbi", "/opt/docker/logs"]
VOLUME ["/opt/docker/logs"]
USER chotbi
ENTRYPOINT ["bin/report-server"]
CMD []
@muuki88 muuki88 added the docker label Mar 25, 2015
@muuki88
Copy link
Contributor

muuki88 commented Mar 25, 2015

Hm. Problem is you can't chown something if you aren't root. The user has to be created, that's what is missing.

@muuki88 muuki88 closed this as completed Mar 25, 2015
@muuki88 muuki88 reopened this Mar 25, 2015
@muuki88
Copy link
Contributor

muuki88 commented Mar 26, 2015

We default to the daemon user, which should be present on most (all?) linux systems. We may need to add this to the docs.

Why do you want to change the user running inside docker?

@muuki88 muuki88 closed this as completed Mar 26, 2015
@nightwolfzor
Copy link
Author

The user ID and user name are needed for underlying authentication with the host os for some services with volume mounts. So we need to be able to create a custom user. It seems weird to have daemonUser in Docker := ... only support preexisting accounts.

@muuki88
Copy link
Contributor

muuki88 commented Mar 26, 2015

I'm not sure what the best practice in this case is. Options coming in mind for me are

  • Create the user on the machine you are building the docker image
  • Create the user within the dockerfile. (you can extend the dockerCommands setting)

cc @fiadliel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants