|
|
@ -287,13 +287,14 @@ def docker_cp_to(args: EnvironmentConfig, container_id: str, src: str, dst: str)
|
|
|
|
def docker_run(
|
|
|
|
def docker_run(
|
|
|
|
args: EnvironmentConfig,
|
|
|
|
args: EnvironmentConfig,
|
|
|
|
image: str,
|
|
|
|
image: str,
|
|
|
|
|
|
|
|
name: str,
|
|
|
|
options: t.Optional[list[str]],
|
|
|
|
options: t.Optional[list[str]],
|
|
|
|
cmd: t.Optional[list[str]] = None,
|
|
|
|
cmd: t.Optional[list[str]] = None,
|
|
|
|
create_only: bool = False,
|
|
|
|
create_only: bool = False,
|
|
|
|
) -> str:
|
|
|
|
) -> str:
|
|
|
|
"""Run a container using the given docker image."""
|
|
|
|
"""Run a container using the given docker image."""
|
|
|
|
if not options:
|
|
|
|
options = list(options or [])
|
|
|
|
options = []
|
|
|
|
options.extend(['--name', name])
|
|
|
|
|
|
|
|
|
|
|
|
if not cmd:
|
|
|
|
if not cmd:
|
|
|
|
cmd = []
|
|
|
|
cmd = []
|
|
|
@ -322,6 +323,7 @@ def docker_run(
|
|
|
|
except SubprocessError as ex:
|
|
|
|
except SubprocessError as ex:
|
|
|
|
display.error(ex.message)
|
|
|
|
display.error(ex.message)
|
|
|
|
display.warning('Failed to run docker image "%s". Waiting a few seconds before trying again.' % image)
|
|
|
|
display.warning('Failed to run docker image "%s". Waiting a few seconds before trying again.' % image)
|
|
|
|
|
|
|
|
docker_rm(args, name) # podman doesn't remove containers after create if run fails
|
|
|
|
time.sleep(3)
|
|
|
|
time.sleep(3)
|
|
|
|
|
|
|
|
|
|
|
|
raise ApplicationError('Failed to run docker image "%s".' % image)
|
|
|
|
raise ApplicationError('Failed to run docker image "%s".' % image)
|
|
|
|