Use CLI for interactive exec on all platforms by default

Add environment setting to enable old behavior (UNIX only)

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2018-01-16 18:41:11 -08:00
parent 98044349a4
commit dcaef15b34
1 changed files with 4 additions and 2 deletions

View File

@ -434,6 +434,8 @@ class TopLevelCommand(object):
-e, --env KEY=VAL Set environment variables (can be used multiple times,
not supported in API < 1.25)
"""
environment = Environment.from_env_file(self.project_dir)
use_cli = not environment.get_boolean('COMPOSE_EXEC_NO_CLI')
index = int(options.get('--index'))
service = self.project.get_service(options['SERVICE'])
detach = options['-d']
@ -448,14 +450,14 @@ class TopLevelCommand(object):
command = [options['COMMAND']] + options['ARGS']
tty = not options["-T"]
if IS_WINDOWS_PLATFORM and not detach:
if IS_WINDOWS_PLATFORM or use_cli and not detach:
sys.exit(call_docker(build_exec_command(options, container.id, command)))
create_exec_options = {
"privileged": options["--privileged"],
"user": options["--user"],
"tty": tty,
"stdin": tty,
"stdin": True,
}
if docker.utils.version_gte(self.project.client.api_version, '1.25'):