mirror of https://github.com/docker/compose.git
Fix one-off commands for "restart: unless-stopped" (fixes #6302)
Signed-off-by: Sebastian Pipping <sebastian@pipping.org>
This commit is contained in:
parent
c32bc095f3
commit
6559af7660
|
@ -1288,7 +1288,7 @@ def build_container_options(options, detach, command):
|
||||||
[""] if options['--entrypoint'] == '' else options['--entrypoint']
|
[""] if options['--entrypoint'] == '' else options['--entrypoint']
|
||||||
)
|
)
|
||||||
|
|
||||||
if options['--rm']:
|
# Ensure that run command remains one-off (issue #6302)
|
||||||
container_options['restart'] = None
|
container_options['restart'] = None
|
||||||
|
|
||||||
if options['--user']:
|
if options['--user']:
|
||||||
|
|
|
@ -171,7 +171,10 @@ class CLITestCase(unittest.TestCase):
|
||||||
'--workdir': None,
|
'--workdir': None,
|
||||||
})
|
})
|
||||||
|
|
||||||
assert mock_client.create_host_config.call_args[1]['restart_policy']['Name'] == 'always'
|
# NOTE: The "run" command is supposed to be a one-off tool; therefore restart policy "no"
|
||||||
|
# (the default) is enforced despite explicit wish for "always" in the project
|
||||||
|
# configuration file
|
||||||
|
assert not mock_client.create_host_config.call_args[1].get('restart_policy')
|
||||||
|
|
||||||
command = TopLevelCommand(project)
|
command = TopLevelCommand(project)
|
||||||
command.run({
|
command.run({
|
||||||
|
|
Loading…
Reference in New Issue