Back to CLI Index

Docker Containers

docker command line guide

Drill down into Docker virtualization commands, stack inspects, network overlays, and process logs.

Interactive BASH Console Sandbox
docker-shell v1.2
Initializing cluster shell connection... [SUCCESS]
Type help to inspect all simulator diagnostics.
$ docker

Standard Commands Included

14 commands mapped
docker build Images

Build a Docker image from a Dockerfile in the specified path.

docker build -t myapp:1.0 .
docker run Containers

Create and start a new container from a specified image.

docker run -d -p 8080:80 nginx
docker ps Containers

List all currently running containers. Use -a flag to include stopped ones.

docker ps -a
docker stop Containers

Gracefully stop one or more running containers by ID or name.

docker stop webserver-prod
docker rm Containers

Remove one or more stopped containers from the local system.

docker rm webserver-prod
docker images Images

List all Docker images stored locally on the host machine.

docker images
docker rmi Images

Remove one or more local Docker images by ID or name tag.

docker rmi myapp:1.0
docker exec Containers

Execute an interactive shell or command inside a running container.

docker exec -it webserver-prod sh
docker logs Diagnostics

Fetch the stdout and stderr logs of a running or stopped container.

docker logs --tail 50 webserver-prod
docker volume Storage

Manage persistent docker volumes for container filesystem layers.

docker volume create data-store
docker network Network

Manage container overlay, bridge, or host network interfaces.

docker network ls
docker-compose Compose

Build, run, and scale multi-container Docker applications.

docker-compose up -d
docker push Images

Upload local container image tags to a Docker registry account.

docker push devknow/myapp:1.0
docker pull Images

Download a container image from the registry without running it.

docker pull alpine:latest