LinuxCommandLibrary

docker-container

Docker container management commands

TLDR

List running containers

$ docker container ls
copy
List all containers
$ docker container ls -a
copy
Run a container
$ docker container run [image]
copy
Start a stopped container
$ docker container start [container]
copy
Stop a container
$ docker container stop [container]
copy
Remove a container
$ docker container rm [container]
copy
Execute command in container
$ docker container exec -it [container] [command]
copy

SYNOPSIS

docker container command [options]

DESCRIPTION

docker container manages Docker containers. It provides commands for the full container lifecycle: creation, execution, monitoring, and removal.
This is the modern syntax; most subcommands also work as direct docker commands (e.g., docker ps = docker container ls).

SUBCOMMANDS

ls

List containers.
run
Create and run a container.
start
Start stopped containers.
stop
Stop running containers.
rm
Remove containers.
exec
Execute command in container.
logs
View container logs.
inspect
Display detailed information.
cp
Copy files between container and host.
stats
Display resource usage statistics.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community