Skip to content

Latest commit

 

History

History
151 lines (95 loc) · 2.12 KB

File metadata and controls

151 lines (95 loc) · 2.12 KB

Docker Commands



Summary of Docker Commands

Organizing because I keep forgetting...


Create container

docker container create [options] [image name] [command] [parameters] 

Run container

docker container run [options] [image name] [command] [parameters]
  • -d : runs on background

Start container

docker container start [container name]
  • Change start to restart for restart

Stop container

docker container stop [container name]

Pause container

docker container pause [container name]

Unpause container

docker container unpause [container name]

Remove container

docker container rm [container name]

Check the log

docker container logs -t webserver
  • realtime : add -f after -t!

Check container stats

docker container stats [container name]

Check process status

docker ps -a

Connect to container

docker exec -it [container ID] sh

List images

docker image ls

or

$ docker images
REPOSITORY                                                            TAG               IMAGE ID       CREATED        SIZE
docker/getting-started                                                latest            021a1b85e641   4 weeks ago    27.6MB
lambci/lambda                                                         build-python3.8   91a48d7f8dd1   6 weeks ago    1.95GB
alpine                                                                latest            d6e46aa2470d   2 months ago   5.57MB

Remove image(s)

docker image rm [OPTIONS] IMAGE [IMAGE ...]
  • For IMAGE, write the IMAGE ID found with the docker image ls command



Docker system prune

Let's delete unused data


docker network prune
docker volume prune
docker container prune
docker image prune
docker system prune  # Remove all unused containers, networks, images (both dangling and unreferenced), and optionally, volumes.