1
0
mirror of https://github.com/docker/compose.git synced 2025-04-08 17:05:13 +02:00

Merge pull request from docker/ghsatpute-5582_UnsetEntrypoint

Allow unsetting entrypoint in run command
This commit is contained in:
Joffrey F 2018-02-27 13:49:22 -08:00 committed by GitHub
commit 4444293c61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions
compose/cli
tests/acceptance

@ -1232,8 +1232,10 @@ def build_container_options(options, detach, command):
if options['--label']:
container_options['labels'] = parse_labels(options['--label'])
if options['--entrypoint']:
container_options['entrypoint'] = options.get('--entrypoint')
if options.get('--entrypoint') is not None:
container_options['entrypoint'] = (
[""] if options['--entrypoint'] == '' else options['--entrypoint']
)
if options['--rm']:
container_options['restart'] = None

@ -1697,6 +1697,18 @@ class CLITestCase(DockerClientTestCase):
assert container.get('Config.Entrypoint') == ['printf']
assert container.get('Config.Cmd') == ['default', 'args']
def test_run_service_with_unset_entrypoint(self):
self.base_dir = 'tests/fixtures/entrypoint-dockerfile'
self.dispatch(['run', '--entrypoint=""', 'test', 'true'])
container = self.project.containers(stopped=True, one_off=OneOffFilter.only)[0]
assert container.get('Config.Entrypoint') is None
assert container.get('Config.Cmd') == ['true']
self.dispatch(['run', '--entrypoint', '""', 'test', 'true'])
container = self.project.containers(stopped=True, one_off=OneOffFilter.only)[0]
assert container.get('Config.Entrypoint') is None
assert container.get('Config.Cmd') == ['true']
def test_run_service_with_dockerfile_entrypoint_overridden(self):
self.base_dir = 'tests/fixtures/entrypoint-dockerfile'
self.dispatch(['run', '--entrypoint', 'echo', 'test'])