Docker Container Commands

$docker container ls
it will list all containers
$docker container ls [option]
– -all, -a: show all containers
– -latest,-l: show the latest created container
– -no-trunc: don’t truncate output
– -filter, -f: Filter output based on condition provided
– -last, -n: show n last created containers
– -size, -s: Display total file sizes

$docker container start
start one or more stopped instances

$docker container stop
stop one or more running containers

$docker container restart
restart one or more container

$docker container run
run a command in a new container

$docker container cp
copy files/folders between a container and the local file system

$docker container create
create a new container

$docker container commit
create a new image from the changes in a container

$docker container rename
rename a container

$docker container stats
shows usage stats of dockers

$docker container top
shows output like unix top command for running process

$docker container update
update configuration of one or more containers

$docker container logs
shows logs of a container

$docker container kill
kill one or more running container

$docker container wait
block till one or more container stops and then print the output

$docker container rm
remove one or more container

$docker container port
list port mapping of a container

$docker container diff
shows the difference in file changes in a container

Read about other Docker commands in the links below: