Module stakkr.docker_actions

Docker functions to get info about containers.

stakkr.docker_actions.add_container_to_network(container: str, network: str)[source]

Attach a container to a network.

stakkr.docker_actions.block_ct_ports(service: str, ports: list, project_name: str) → tuple[source]

Run iptables commands to block a list of port on a specific container.

stakkr.docker_actions.check_cts_are_running(project_name: str)[source]

Throw an error if cts are not running.

stakkr.docker_actions.container_running(container: str)[source]

Return True if the container is running else False.

stakkr.docker_actions.create_network(network: str)[source]

Create a Network.


Return the API client or initialize it.


Return the client or initialize it.

stakkr.docker_actions.get_ct_item(compose_name: str, item_name: str)[source]

Get a value from a container, such as name or IP.

stakkr.docker_actions.get_ct_name(container: str)[source]

Return the system name of a container, generated by docker-compose.

stakkr.docker_actions.get_network_name(project_name: str)[source]

Find the full network name.

stakkr.docker_actions.get_running_containers(project_name: str) → tuple[source]

Get the number of running containers and theirs details for the current stakkr instance.

stakkr.docker_actions.get_running_containers_names(project_name: str) → list[source]

Get a list of compose names of running containers for the current stakkr instance.

stakkr.docker_actions.get_subnet(project_name: str)[source]

Find the subnet of the current project.


Find the main docker daemon IP to add routes.

stakkr.docker_actions.guess_shell(container: str) → str[source]

By searching for binaries, guess what could be the primary shell available.

stakkr.docker_actions.network_exists(network: str)[source]

Return True if a network exists in docker, else False.