diff options
Diffstat (limited to 'compose/cli')
-rw-r--r-- | compose/cli/command.py | 6 | ||||
-rw-r--r-- | compose/cli/main.py | 26 |
2 files changed, 25 insertions, 7 deletions
diff --git a/compose/cli/command.py b/compose/cli/command.py index 9fd941bb..8a32a93a 100644 --- a/compose/cli/command.py +++ b/compose/cli/command.py @@ -122,12 +122,14 @@ def get_project(project_dir, config_path=None, project_name=None, verbose=False, ) with errors.handle_connection_errors(client): - return Project.from_config(project_name, config_data, client) + return Project.from_config( + project_name, config_data, client, environment.get('DOCKER_DEFAULT_PLATFORM') + ) def get_project_name(working_dir, project_name=None, environment=None): def normalize_name(name): - return re.sub(r'[^a-z0-9]', '', name.lower()) + return re.sub(r'[^-_a-z0-9]', '', name.lower()) if not environment: environment = Environment.from_env_file(working_dir) diff --git a/compose/cli/main.py b/compose/cli/main.py index 5e077abe..a9720583 100644 --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -254,6 +254,7 @@ class TopLevelCommand(object): Usage: build [options] [--build-arg key=val...] [SERVICE...] Options: + --compress Compress the build context using gzip. --force-rm Always remove intermediate containers. --no-cache Do not use cache when building the image. --pull Always attempt to pull a newer version of the image. @@ -277,7 +278,9 @@ class TopLevelCommand(object): pull=bool(options.get('--pull', False)), force_rm=bool(options.get('--force-rm', False)), memory=options.get('--memory'), - build_args=build_args) + build_args=build_args, + gzip=options.get('--compress', False), + ) def bundle(self, options): """ @@ -459,6 +462,7 @@ class TopLevelCommand(object): instances of a service [default: 1] -e, --env KEY=VAL Set environment variables (can be used multiple times, not supported in API < 1.25) + -w, --workdir DIR Path to workdir directory for this command. """ environment = Environment.from_env_file(self.project_dir) use_cli = not environment.get_boolean('COMPOSE_INTERACTIVE_NO_CLI') @@ -467,7 +471,12 @@ class TopLevelCommand(object): detach = options.get('--detach') if options['--env'] and docker.utils.version_lt(self.project.client.api_version, '1.25'): - raise UserError("Setting environment for exec is not supported in API < 1.25'") + raise UserError("Setting environment for exec is not supported in API < 1.25 (%s)" + % self.project.client.api_version) + + if options['--workdir'] and docker.utils.version_lt(self.project.client.api_version, '1.35'): + raise UserError("Setting workdir for exec is not supported in API < 1.35 (%s)" + % self.project.client.api_version) try: container = service.get_container(number=index) @@ -487,6 +496,7 @@ class TopLevelCommand(object): "user": options["--user"], "tty": tty, "stdin": True, + "workdir": options["--workdir"], } if docker.utils.version_gte(self.project.client.api_version, '1.25'): @@ -704,14 +714,17 @@ class TopLevelCommand(object): Options: --ignore-pull-failures Pull what it can and ignores images with pull failures. - --parallel Pull multiple images in parallel. + --parallel Deprecated, pull multiple images in parallel (enabled by default). + --no-parallel Disable parallel pulling. -q, --quiet Pull without printing progress information --include-deps Also pull services declared as dependencies """ + if options.get('--parallel'): + log.warn('--parallel option is deprecated and will be removed in future versions.') self.project.pull( service_names=options['SERVICE'], ignore_pull_failures=options.get('--ignore-pull-failures'), - parallel_pull=options.get('--parallel'), + parallel_pull=not options.get('--no-parallel'), silent=options.get('--quiet'), include_deps=options.get('--include-deps'), ) @@ -1408,7 +1421,7 @@ def call_docker(args, dockeropts): if verify: tls_options.append('--tlsverify') if host: - tls_options.extend(['--host', host]) + tls_options.extend(['--host', host.lstrip('=')]) args = [executable_path] + tls_options + args log.debug(" ".join(map(pipes.quote, args))) @@ -1453,6 +1466,9 @@ def build_exec_command(options, container_id, command): for env_variable in options["--env"]: args += ["--env", env_variable] + if options["--workdir"]: + args += ["--workdir", options["--workdir"]] + args += [container_id] args += command return args |