Provide user override option on command line

Allows overriding a user on the command line from the one specified in
the docker-compose.yml

The added tests verify that a specified user overrides a default
user in the docker-compose.yml file.

Based on commit f2f01e207b491866349db7168e3d48082d7abdda by @chmouel

Signed-off-by: Ian VanSchooten <ian@badgelabsllc.com>
This commit is contained in:
Ian VanSchooten 2015-02-14 21:08:47 -05:00
commit 86b723e227
4 changed files with 32 additions and 0 deletions

View file

@ -275,6 +275,7 @@ class TopLevelCommand(Command):
new container name.
--entrypoint CMD Override the entrypoint of the image.
-e KEY=VAL Set an environment variable (can be used multiple times)
-u, --user="" Run as specified username or uid
--no-deps Don't start linked services.
--rm Remove container after run. Ignored in detached mode.
--service-ports Run command with the service's ports enabled and mapped
@ -322,6 +323,10 @@ class TopLevelCommand(Command):
if options['--entrypoint']:
container_options['entrypoint'] = options.get('--entrypoint')
if options['--user']:
container_options['user'] = options.get('--user')
container = service.create_container(
one_off=True,
insecure_registry=insecure_registry,