MCPcopy Create free account
hub / github.com/benzaita/dockerized-cli / execute_command

Method execute_command

dockerized/adapters/dockercompose.py:43–60  ·  view source on GitHub ↗
(self, docker_compose_args)

Source from the content-addressed store, hash-verified

41 return self.execute_command(['build', self.service_name])
42
43 def execute_command(self, docker_compose_args):
44 # Why not use the Docker Compose API directly?
45 # Because [it is not officially supported](https://github.com/docker/compose/issues/4542#issuecomment-283191533)
46 args = [
47 'docker-compose',
48 *self.__get_compose_filename_args(self.compose_files),
49 '--project-name', str(self.project_dir)
50 ]
51 args.extend(docker_compose_args)
52 logger.info(f"Running: {args}")
53 try:
54 process = subprocess.Popen(args, stdout=sys.stdout, stderr=sys.stderr)
55 exit_code = process.wait()
56 except Exception as e:
57 logger.error(f"Raised exception: {e}")
58 raise e
59 logger.info(f"Finished with exit-code {exit_code}")
60 return exit_code
61
62 def __get_compose_filename_args(self, compose_files: List[Path]):
63 args = []

Callers 6

runMethod · 0.95
downMethod · 0.95
pushMethod · 0.95
pullMethod · 0.95
buildMethod · 0.95
runMethod · 0.80

Calls 2

waitMethod · 0.80

Tested by

no test coverage detected