cwltool.docker_id

Helper functions for docker.

Functions

docker_vm_id()

Return the User ID and Group ID of the default docker user inside the VM.

check_output_and_strip(cmd)

Pass a command list to subprocess.check_output().

docker_machine_name()

Get the machine name of the active docker-machine machine.

cmd_output_matches(check_cmd, expected_status)

Run a command and compares output to expected.

boot2docker_running()

Check if boot2docker CLI reports that boot2docker vm is running.

docker_machine_running()

Ask docker-machine for the active machine and checks if its VM is running.

cmd_output_to_int(cmd)

Run the provided command and returns the integer value of the result.

boot2docker_id()

Get the UID and GID of the docker user inside a running boot2docker vm.

docker_machine_id()

Ask docker-machine for active machine and gets the UID of the docker user.

Module Contents

cwltool.docker_id.docker_vm_id()

Return the User ID and Group ID of the default docker user inside the VM.

When a host is using boot2docker or docker-machine to run docker with boot2docker.iso (As on Mac OS X), the UID that mounts the shared filesystem inside the VirtualBox VM is likely different than the user’s UID on the host. :return: A tuple containing numeric User ID and Group ID of the docker account inside the boot2docker VM

Return type:

Tuple[Optional[int], Optional[int]]

cwltool.docker_id.check_output_and_strip(cmd)

Pass a command list to subprocess.check_output().

Returning None if an expected exception is raised :param cmd: The command to execute :return: Stripped string output of the command, or None if error

Parameters:

cmd (List[str])

Return type:

Optional[str]

cwltool.docker_id.docker_machine_name()

Get the machine name of the active docker-machine machine.

Returns:

Name of the active machine or None if error

Return type:

Optional[str]

cwltool.docker_id.cmd_output_matches(check_cmd, expected_status)

Run a command and compares output to expected.

Parameters:
  • check_cmd (List[str]) – Command list to execute

  • expected_status (str) – Expected output, e.g. “Running” or “poweroff”

Returns:

Boolean value, indicating whether or not command result matched

Return type:

bool

cwltool.docker_id.boot2docker_running()

Check if boot2docker CLI reports that boot2docker vm is running.

Returns:

True if vm is running, False otherwise

Return type:

bool

cwltool.docker_id.docker_machine_running()

Ask docker-machine for the active machine and checks if its VM is running.

Returns:

True if vm is running, False otherwise

Return type:

bool

cwltool.docker_id.cmd_output_to_int(cmd)

Run the provided command and returns the integer value of the result.

Parameters:

cmd (List[str]) – The command to run

Returns:

Integer value of result, or None if an error occurred

Return type:

Optional[int]

cwltool.docker_id.boot2docker_id()

Get the UID and GID of the docker user inside a running boot2docker vm.

Returns:

Tuple (UID, GID), or (None, None) if error (e.g. boot2docker not present or stopped)

Return type:

Tuple[Optional[int], Optional[int]]

cwltool.docker_id.docker_machine_id()

Ask docker-machine for active machine and gets the UID of the docker user.

inside the vm :return: tuple (UID, GID), or (None, None) if error (e.g. docker-machine not present or stopped)

Return type:

Tuple[Optional[int], Optional[int]]