Skip to content

ContainerCLI

attach

attach(container, detach_keys=None, stdin=True, sig_proxy=True)

Attach local standard input, output, and error streams to a running container

Alias: docker.attach(...)

Parameters:

Name Type Description Default
container ValidContainer

The running container to attach to

required
detach_keys Optional[str]

Override the key sequence for detaching a container

None
stdin bool

Attach STDIN

True
sig_proxy bool

Proxy all received signals to the process (default true)

True

Raises

`python_on_whales.exceptions.NoSuchContainer` if the container does not exists.

commit

commit(container, tag=None, author=None, message=None, pause=True)

Create a new image from a container's changes

Parameters:

Name Type Description Default
container ValidContainer

The container to create the image from

required
tag Optional[str]

tag to apply on the image produced

None
author Optional[str]

Author (e.g., "John Hannibal Smith hannibal@a-team.com")

None
message Optional[str]

Commit message

None
pause bool

Pause container during commit

True

copy

copy(source, destination)

Copy files/folders between a container and the local filesystem

Alias: docker.copy(...)

from python_on_whales import docker

docker.run("ubuntu", ["sleep", "infinity"], name="dodo", remove=True, detach=True)

docker.copy("/tmp/my_local_file.txt", ("dodo", "/path/in/container.txt"))
docker.copy(("dodo", "/path/in/container.txt"), "/tmp/my_local_file2.txt")

Doesn't yet support sending or receiving iterators of Python bytes.

Parameters:

Name Type Description Default
source Union[ValidPath, ContainerPath]

Local path or tuple. When using a tuple, the first element of the tuple is the container, the second element is the path in the container. ex: source=("my-container", "/usr/bin/something").

required
destination Union[ValidPath, ContainerPath]

Local path or tuple. When using a tuple, the first element of the tuple is the container, the second element is the path in the container. ex: source=("my-container", "/usr/bin/something").

required

create

create(image, command=[], *, add_hosts=[], blkio_weight=None, blkio_weight_device=[], cap_add=[], cap_drop=[], cgroup_parent=None, cgroupns=None, cidfile=None, cpu_period=None, cpu_quota=None, cpu_rt_period=None, cpu_rt_runtime=None, cpu_shares=None, cpus=None, cpuset_cpus=None, cpuset_mems=None, detach=False, devices=[], device_cgroup_rules=[], device_read_bps=[], device_read_iops=[], device_write_bps=[], device_write_iops=[], content_trust=False, dns=[], dns_options=[], dns_search=[], domainname=None, entrypoint=None, envs={}, env_files=[], env_host=False, expose=[], gpus=None, groups_add=[], healthcheck=True, health_cmd=None, health_interval=None, health_retries=None, health_start_period=None, health_timeout=None, hostname=None, init=False, interactive=False, ip=None, ip6=None, ipc=None, isolation=None, kernel_memory=None, labels={}, label_files=[], link=[], link_local_ip=[], log_driver=None, log_options=[], mac_address=None, memory=None, memory_reservation=None, memory_swap=None, memory_swappiness=None, mounts=[], name=None, networks=[], network_aliases=[], oom_kill=True, oom_score_adj=None, pid=None, pids_limit=None, platform=None, privileged=False, publish=[], publish_all=False, pull='missing', read_only=False, restart=None, remove=False, runtime=None, security_options=[], shm_size=None, sig_proxy=True, stop_signal=None, stop_timeout=None, storage_options=[], sysctl={}, systemd=None, tmpfs=[], tty=False, tz=None, ulimit=[], user=None, userns=None, uts=None, volumes=[], volume_driver=None, volumes_from=[], workdir=None)

Creates a container, but does not start it.

Alias: docker.create(...)

Start it then with the .start() method.

It might be useful if you want to delay the start of a container, to do some preparations beforehand. For example, it's common to do this workflow: docker create -> docker cp -> docker start to put files in the container before starting.

There is no detach argument since it's a runtime option.

The arguments are the same as docker.run.

diff

diff(container)

List all the files modified, added or deleted since the container started.

Alias: docker.diff(...)

Parameters:

Name Type Description Default
container ValidContainer

The container to inspect

required

Returns

`Dict[str, str]` Something like
`{"/some_path": "A", "/some_file": "M", "/tmp": "D"}` for example.

execute

execute(container, command, detach=False, envs={}, env_files=[], interactive=False, privileged=False, tty=False, user=None, workdir=None, stream=False, detach_keys=None, preserve_fds=None)

Execute a command inside a container

Alias: docker.execute(...)

Parameters:

Name Type Description Default
container ValidContainer

The container to execute the command in.

required
command List[str]

The command to execute.

required
detach bool

if True, returns immediately with None. If False, returns the command stdout as string.

False
envs Dict[str, str]

Set environment variables

{}
env_files Union[ValidPath, List[ValidPath]]

Read one or more files of environment variables

[]
interactive bool

Leave stdin open during the duration of the process to allow communication with the parent process. Currently only works with tty=True for interactive use on the terminal.

False
preserve_fds Optional[int]

The number of additional file descriptors to pass through to the container. Only supported by podman.

None
privileged bool

Give extended privileges to the container.

False
tty bool

Allocate a pseudo-TTY. Allow the process to access your terminal to write on it.

False
user Optional[str]

Username or UID, format: "<name|uid>[:<group|gid>]"

None
workdir Optional[ValidPath]

Working directory inside the container

None
stream bool

Similar to docker.run(..., stream=True).

False
detach_keys Optional[str]

Override the key sequence for detaching a container.

None

Returns:

Type Description
Union[None, str, Iterable[Tuple[str, bytes]]]

Optional[str]

Raises

`python_on_whales.exceptions.NoSuchContainer` if the container does not exists.

exists

exists(x)

Returns True if the container exists. False otherwise.

It's just calling docker.container.inspect(...) and verifies that it doesn't throw a python_on_whales.exceptions.NoSuchContainer.

Returns

A `bool`

export

export(container, output)

Export a container's filesystem as a tar archive

Alias: docker.export(...)

Parameters:

Name Type Description Default
container ValidContainer

The container to export.

required
output ValidPath

The path of the output tar archive. Returning a generator of bytes is not yet implemented.

required

Raises

`python_on_whales.exceptions.NoSuchContainer` if the container does not exists.

inspect

inspect(x)

Returns a container object from a name or ID.

Parameters:

Name Type Description Default
x Union[ValidContainer, List[ValidContainer]]

A container name or ID, or a list of container names and/or IDs

required

Returns:

Type Description
Union[Container, List[Container]]

A python_on_whales.Container object or a list of those

Union[Container, List[Container]]

if a list of IDs was passed as input.

Raises

`python_on_whales.exceptions.NoSuchContainer` if the container does not exists.

kill

kill(containers, signal=None)

Kill one or more containers.

Alias: docker.kill(...)

Parameters:

Name Type Description Default
containers Union[ValidContainer, List[ValidContainer]]

One or more containers to kill

required
signal Optional[Union[int, str]]

The signal to send the container

None

Raises

`python_on_whales.exceptions.NoSuchContainer` if any of the
containers do not exist.

list

list(all=False, filters={})

List the containers on the host.

Alias: docker.ps(...)

Parameters:

Name Type Description Default
all bool

If True, also returns containers that are not running.

False

Returns

A `List[python_on_whales.Container]`

logs

logs(container, *, details=False, since=None, tail=None, timestamps=False, until=None, follow=False, stream=False)

Returns the logs of a container as a string or an iterator.

Alias: docker.logs(...)

Parameters:

Name Type Description Default
container ValidContainer

The container to get the logs of

required
details bool

Show extra details provided to logs

False
since Union[None, datetime, timedelta]

Use a datetime or timedelta to specify the lower date limit for the logs.

None
tail Optional[int]

Number of lines to show from the end of the logs (default all)

None
timestamps bool

Put timestamps next to lines.

False
until Union[None, datetime, timedelta]

Use a datetime or a timedelta to specify the upper date limit for the logs.

None
follow bool

If False (the default), the logs returned are the logs up to the time of the function call. If True, the logs of the container up to the time the container stopped are displayed. Which means that if the container isn't stopped yet, the function will continue until the container is stopped. Which is why it is advised to use the stream option if you use the follow option. Without stream, only a str will be returned, possibly much later in the future. With stream, you'll be able to read the logs in real time.

False
stream bool

Similar to the stream argument of docker.run. This function will then return an iterator that will yield a tuple (source, content) with source being "stderr" or "stdout". content is the content of the line as bytes. Take a look at the user guide to have an example of the output.

False

Returns

`str` if `stream=False` (the default), `Iterable[Tuple[str, bytes]]`
if `stream=True`.

Raises

`python_on_whales.exceptions.NoSuchContainer` if the container does not exist.

If you are a bit confused about follow and stream, here are some use cases.

  • If you want to have the logs up to this point as a str, don't use those args.
  • If you want to stream the output in real time, use follow=True, stream=True
  • If you want the logs up to this point, but you don't want to fit all the logs in memory because they are too big, use stream=True.

pause

pause(containers)

Pauses one or more containers

Alias: docker.pause(...)

Parameters:

Name Type Description Default
containers Union[ValidContainer, List[ValidContainer]]

One or more containers to pause

required

Raises

`python_on_whales.exceptions.NoSuchContainer` if the container does not exists.

prune

prune(filters={}, stream_logs=False)

Remove containers that are not running.

Parameters:

Name Type Description Default
filters Dict[str, str]

Filters as strings or list of strings

{}
stream_logs bool

If True this function will return an iterator of strings. You can then read the logs as they arrive. If False (the default value), then the function returns None, but when it returns, then the prune operation has already been done.

False

remove

remove(containers, *, force=False, volumes=False)

Removes a container

Alias: docker.remove(...)

Parameters:

Name Type Description Default
containers Union[ValidContainer, List[ValidContainer]]

One or more containers.

required
force bool

Force the removal of a running container (uses SIGKILL)

False
volumes bool

Remove anonymous volumes associated with the container

False

Raises

`python_on_whales.exceptions.NoSuchContainer` if the container does not exists.

rename

rename(container, new_name)

Changes the name of a container.

Alias: docker.rename(...)

Parameters:

Name Type Description Default
container ValidContainer

The container to rename

required
new_name str

The new name of the container.

required

Raises

`python_on_whales.exceptions.NoSuchContainer` if the container does not exist.

restart

restart(containers, time=None)

Restarts one or more container.

Alias: docker.restart(...)

Parameters:

Name Type Description Default
containers Union[ValidContainer, List[ValidContainer]]

One or more containers to restart

required
time Optional[Union[int, timedelta]]

Amount of to wait for stop before killing the container (default 10s). If int, the unit is seconds.

None

Raises

`python_on_whales.exceptions.NoSuchContainer` if the container does not exists.

run

run(image, command=[], *, add_hosts=[], blkio_weight=None, blkio_weight_device=[], cap_add=[], cap_drop=[], cgroup_parent=None, cgroupns=None, cidfile=None, cpu_period=None, cpu_quota=None, cpu_rt_period=None, cpu_rt_runtime=None, cpu_shares=None, cpus=None, cpuset_cpus=None, cpuset_mems=None, detach=False, devices=[], device_cgroup_rules=[], device_read_bps=[], device_read_iops=[], device_write_bps=[], device_write_iops=[], content_trust=False, dns=[], dns_options=[], dns_search=[], domainname=None, entrypoint=None, envs={}, env_files=[], env_host=False, expose=[], gpus=None, groups_add=[], healthcheck=True, health_cmd=None, health_interval=None, health_retries=None, health_start_period=None, health_timeout=None, hostname=None, init=False, interactive=False, ip=None, ip6=None, ipc=None, isolation=None, kernel_memory=None, labels={}, label_files=[], link=[], link_local_ip=[], log_driver=None, log_options=[], mac_address=None, memory=None, memory_reservation=None, memory_swap=None, memory_swappiness=None, mounts=[], name=None, networks=[], network_aliases=[], oom_kill=True, oom_score_adj=None, pid=None, pids_limit=None, platform=None, preserve_fds=None, privileged=False, publish=[], publish_all=False, pull='missing', read_only=False, restart=None, remove=False, runtime=None, security_options=[], shm_size=None, sig_proxy=True, stop_signal=None, stop_timeout=None, storage_options=[], stream=False, sysctl={}, systemd=None, tmpfs=[], tty=False, tz=None, ulimit=[], user=None, userns=None, uts=None, volumes=[], volume_driver=None, volumes_from=[], workdir=None)

Runs a container

You can use docker.run or docker.container.run to call this function.

For a deeper dive into the arguments and what they do, visit https://docs.docker.com/engine/reference/run/

If you want to know exactly how to call docker.run() depending on your use case (detach, stream...), take a look at the docker.run() guide.

>>> from python_on_whales import docker
>>> returned_string = docker.run("hello-world")
>>> print(returned_string)

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/
>>> from python_on_whales import docker
>>> result_string = docker.run("ubuntu", ["ls", "/host"], volumes=[("/", "/host", "ro")])
>>> print(result_string)
bin
boot
dev
etc
home
init
lib
lib64
lost+found
media
mnt
opt
proc
projects
root
run
sbin
snap
srv
sys
tmp
usr
var

Parameters:

Name Type Description Default
image python_on_whales.components.image.cli_wrapper.ValidImage

The docker image to use for the container

required
command List[str]

List of arguments to provide to the container.

[]
add_hosts List[Tuple[str, str]]

hosts to add in the format of a tuple. For example, add_hosts=[("my_host_1", "192.168.30.31"), ("host2", "192.168.80.81")]

[]
blkio_weight Optional[int]

Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)

None
cgroupns Optional[str]

Cgroup namespace mode to use, one of 'host' or 'private'.

None
cpu_period Optional[int]

Limit CPU CFS (Completely Fair Scheduler) period

None
cpu_quota Optional[int]

Limit CPU CFS (Completely Fair Scheduler) quota

None
cpu_rt_period Optional[int]

Limit CPU real-time period in microseconds

None
cpu_rt_runtime Optional[int]

Limit CPU real-time runtime in microseconds

None
cpu_shares Optional[int]

CPU shares (relative weight)

None
cpus Optional[float]

The maximal amount of cpu the container can use. 1 means one cpu core.

None
cpuset_cpus Optional[List[int]]

CPUs in which to allow execution. Must be given as a list.

None
cpuset_mems Optional[List[int]]

MEMs in which to allow execution. Must be given as a list.

None
detach bool

If False, returns the ouput of the container as a string. If True, returns a python_on_whales.Container object.

False
dns_search List[str]

Set custom DNS search domains

[]
domainname Optional[str]

Container NIS domain name

None
entrypoint Optional[str]

Overwrite the default ENTRYPOINT of the image

None
envs Dict[str, str]

Environment variables as a dict. For example: {"OMP_NUM_THREADS": 3}

{}
env_files Union[ValidPath, List[ValidPath]]

One or a list of env files.

[]
env_host bool

Use host environment inside the container. Only supported with podman.

False
gpus Union[int, str, None]

For this to work, you need the Nvidia container runtime The value needed is a str or int. Some examples of valid argument are "all" or "device=GPU-3a23c669-1f69-c64e-cf85-44e9b07e7a2a" or "device=0,2". If you want 3 gpus, just write gpus=3.

None
hostname Optional[str]

Container host name

None
interactive bool

Leave stdin open during the duration of the process to allow communication with the parent process. Currently only works with tty=True for interactive use on the terminal.

False
ip Optional[str]

IPv4 address (e.g., 172.30.100.104)

None
ip6 Optional[str]

IPv6 address (e.g., 2001:db8::33)

None
ipc Optional[str]

IPC mode to use

None
isolation Optional[str]

Container isolation technology

None
kernel_memory Union[int, str, None]

Kernel memory limit. int represents the number of bytes, but you can use "4k" or 2g for example.

None
labels Dict[str, str]

Set meta data on a container. The labels can be used later when filtering containers with docker.ps(filters='...'). The labels can also be found on each container with the attribute my_container.config.labels.

{}
log_driver Optional[str]

Logging driver for the container

None
mac_address Optional[str]

Container MAC address (e.g., "92:d0:c6:0a:29:33")

None
memory Union[int, str, None]

Memory limit, valid values are 1024 (ints are bytes) or "43m" or "6g".

None
memory_reservation Union[int, str, None]

Memory soft limit

None
memory_swap Union[int, str, None]

Swap limit equal to memory plus swap: '-1' to enable unlimited swap.

None
memory_swappiness Optional[int]

Tune container memory swappiness (0 to 100) (default -1)

None
name Optional[str]

The container name. If not provided, one is automatically genrated for you.

None
healthcheck bool

Set to False to disable container periodic healthcheck.

True
oom_kill bool

Set to False to disable the OOM killer for this container.

True
pid Optional[str]

PID namespace to use

None
pids_limit Optional[int]

Tune container pids limit (set -1 for unlimited)

None
platform Optional[str]

Set platform if server is multi-platform capable.

None
preserve_fds Optional[int]

The number of additional file descriptors to pass through to the container. Only supported by podman.

None
privileged bool

Give extended privileges to this container.

False
publish List[ValidPortMapping]

Ports to publish, same as the -p argument in the Docker CLI. example are [(8000, 7000) , ("127.0.0.1:3000", 2000)] or [("127.0.0.1:3000", 2000, "udp")]. You can also use a single entry in the tuple to signify that you want a random free port on the host. For example: publish=[(80,)].

[]
publish_all bool

Publish all exposed ports to random ports.

False
pull str

Pull image before running ("always"|"missing"|"never") (default "missing").

'missing'
read_only bool

Mount the container's root filesystem as read only.

False
restart Optional[str]

Restart policy to apply when a container exits (default "no")

None
remove bool

Automatically remove the container when it exits.

False
runtime Optional[str]

Runtime to use for this container.

None
security_options List[str]

Security options

[]
shm_size Union[int, str, None]

Size of /dev/shm. int is for bytes. But you can use "512m" or "4g" for example.

None
stop_timeout Optional[int]

Signal to stop a container (default "SIGTERM")

None
storage_options List[str]

Storage driver options for the container

[]
systemd Optional[Union[bool, Literal['always']]]

Whether to run in systemd mode. Only known to apply to Podman, see https://docs.podman.io/en/latest/markdown/podman-run.1.html#systemd-true-false-always

None
tty bool

Allocate a pseudo-TTY. Allow the process to access your terminal to write on it.

False
tz Optional[str]

Set timezone in container, or local to match the host's timezone. See /usr/share/zoneinfo/ for valid timezones. Note: This option is only known to apply to Podman containers.

None
user Optional[str]

Username or UID (format: <name|uid>[:<group|gid>])

None
userns Optional[str]

User namespace to use

None
uts Optional[str]

UTS namespace to use

None
volumes Optional[List[python_on_whales.components.volume.cli_wrapper.VolumeDefinition]]

Bind mount a volume. Some examples: [("/", "/host"), ("/etc/hosts", "/etc/hosts", "rw")].

[]
volume_driver Optional[str]

Optional volume driver for the container

None
workdir Optional[ValidPath]

The directory in the container where the process will be executed.

None

Returns

The container output as a string if detach is `False` (the default),
and a `python_on_whales.Container` if detach is `True`.

start

start(containers, attach=False, interactive=False, stream=False, detach_keys=None)

Starts one or more created/stopped containers.

Aliases: docker.start, docker.container.start, python_on_whales.Container.start.

Parameters:

Name Type Description Default
containers Union[ValidContainer, List[ValidContainer]]

One or a list of containers.

required
attach bool

Attach stdout/stderr and forward signals.

False
interactive bool

Attach stdin (ensure it is open).

False
stream bool

Stream output as a generator.

False
detach_keys Optional[str]

Override the key sequence for detaching a container.

None

stats

stats(containers=None, all=False)

Get containers resource usage statistics

Alias: docker.stats(...)

Usage:

from python_on_whales import docker

docker.run("redis", detach=True)
print(docker.stats())
# [<<class 'python_on_whales.components.container.ContainerStats'> object,
# attributes are block_read=0, block_write=0, cpu_percentage=0.08,
# container=e90ae41a5b17,
# container_id=e90ae41a5b17df998584141692f1e361c485e8d00c37ee21fdc360d3523dd1c1,
# memory_percentage=0.18, memory_used=11198791, memory_limit=6233071288,
# container_name=crazy_northcutt, net_upload=696, net_download=0>]

The data unit is the byte.

Parameters:

Name Type Description Default
all bool

Get the stats of all containers, not just running ones.

False
containers Optional[Union[ValidContainer, List[ValidContainer]]]

One or a list of containers.

None

Returns

A `List[python_on_whales.ContainerStats]`.

stop

stop(containers, time=None)

Stops one or more running containers

Alias: docker.stop(...)

Aliases: docker.stop, docker.container.stop, python_on_whales.Container.stop.

Parameters:

Name Type Description Default
containers Union[ValidContainer, List[ValidContainer]]

One or a list of containers.

required
time Optional[Union[int, timedelta]]

Seconds to wait for stop before killing a container (default 10)

None

Raises

`python_on_whales.exceptions.NoSuchContainer` if any of the
containers do not exist.

top

top()

Get the running processes of a container

Alias: docker.top(...)

Not yet implemented

unpause

unpause(x)

Unpause all processes within one or more containers

Alias: docker.unpause(...)

Parameters:

Name Type Description Default
x Union[ValidContainer, List[ValidContainer]]

One or more containers (name, id or python_on_whales.Container object).

required

Raises

`python_on_whales.exceptions.NoSuchContainer` if any of the
containers do not exist.

update

update(x, /, *, blkio_weight=None, cpu_period=None, cpu_quota=None, cpu_rt_period=None, cpu_rt_runtime=None, cpu_shares=None, cpus=None, cpuset_cpus=None, cpuset_mems=None, kernel_memory=None, memory=None, memory_reservation=None, memory_swap=None, pids_limit=None, restart=None)

Update configuration of one or more containers

Alias: docker.update(...)

Parameters:

Name Type Description Default
x Union[ValidContainer, List[ValidContainer]]

One or a list of containers to update.

required
blkio_weight Optional[int]

Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)

None
cpu_period Optional[int]

Limit CPU CFS (Completely Fair Scheduler) period

None
cpu_quota Optional[int]

Limit CPU CFS (Completely Fair Scheduler) quota

None
cpu_rt_period Optional[int]

Limit CPU real-time period in microseconds

None
cpu_rt_runtime Optional[int]

Limit CPU real-time runtime in microseconds

None
cpu_shares Optional[int]

CPU shares (relative weight)

None
cpus Optional[float]

The maximal amount of cpu the container can use. 1 means one cpu core.

None
cpuset_cpus Optional[List[int]]

CPUs in which to allow execution. Must be given as a list.

None
cpuset_mems Optional[List[int]]

MEMs in which to allow execution. Must be given as a list.

None
memory Union[int, str, None]

Memory limit, valid values are 1024 (ints are bytes) or "43m" or "6g".

None
memory_reservation Union[int, str, None]

Memory soft limit

None
memory_swap Union[int, str, None]

Swap limit equal to memory plus swap: '-1' to enable unlimited swap.

None
pids_limit Optional[int]

Tune container pids limit (set -1 for unlimited)

None
restart Optional[str]

Restart policy to apply when a container exits (default "no")

None

Raises

`python_on_whales.exceptions.NoSuchContainer` if the container does not exists.

wait

wait(x)

Block until one or more containers stop, then returns their exit codes

Alias: docker.wait(...)

Parameters:

Name Type Description Default
x Union[ValidContainer, List[ValidContainer]]

One or a list of containers to wait for.

required

Returns

An `int` if a single container was passed as argument or a list of ints
if multiple containers were passed as arguments.

Some Examples:

cont = docker.run("ubuntu", ["bash", "-c", "sleep 2 && exit 8"], detach=True)

exit_code = docker.wait(cont)

print(exit_code)
# 8
docker.container.remove(cont)
cont_1 = docker.run("ubuntu", ["bash", "-c", "sleep 4 && exit 8"], detach=True)
cont_2 = docker.run("ubuntu", ["bash", "-c", "sleep 2 && exit 10"], detach=True)

exit_codes = docker.wait([cont_1, cont_2])

print(exit_codes)
# [8, 10]
docker.container.remove([cont_1, cont_2])

Raises

`python_on_whales.exceptions.NoSuchContainer` if the container does not exists.