mirror of https://github.com/docker/compose.git
unset entrypoint test
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
59c8ed77e4
commit
1096a903be
|
@ -1232,7 +1232,10 @@ def build_container_options(options, detach, command):
|
|||
if options['--label']:
|
||||
container_options['labels'] = parse_labels(options['--label'])
|
||||
|
||||
_build_container_entrypoint_options(container_options, options)
|
||||
if options.get('--entrypoint') is not None:
|
||||
container_options['entrypoint'] = (
|
||||
[""] if options['--entrypoint'] == '' else options['--entrypoint']
|
||||
)
|
||||
|
||||
if options['--rm']:
|
||||
container_options['restart'] = None
|
||||
|
@ -1259,16 +1262,6 @@ def build_container_options(options, detach, command):
|
|||
return container_options
|
||||
|
||||
|
||||
def _build_container_entrypoint_options(container_options, options):
|
||||
if options['--entrypoint']:
|
||||
if options['--entrypoint'].strip() == '':
|
||||
# Set an empty entry point. Refer https://github.com/moby/moby/pull/23718
|
||||
log.info("Overriding the entrypoint")
|
||||
container_options['entrypoint'] = [""]
|
||||
else:
|
||||
container_options['entrypoint'] = options.get('--entrypoint')
|
||||
|
||||
|
||||
def run_one_off_container(container_options, project, service, options, toplevel_options,
|
||||
project_dir='.'):
|
||||
if not options['--no-deps']:
|
||||
|
|
|
@ -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'])
|
||||
|
|
Loading…
Reference in New Issue