summaryrefslogtreecommitdiffstats
path: root/cheats/docker.cheat
blob: 098b3a5169129acbc15c966d46948eedf0825c53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
% docker, container

# Remove an image
docker image rm <image_id>

# Delete an image from the local image store
docker rmi <image_id>

# List all images that are locally stored with the Docker engine
docker images

# Build an image from the Dockerfile in the current directory and tag the image
docker build -t <image>:<version> .

# Pull an image from a registry
docker pull <image>:<version>

# Stop a running container through SIGTERM
docker stop <container_id>

# Stop a running container through SIGKILL
docker kill <container_id>

# List the networks
docker network ls

# List the running containers
docker ps

# Delete all running and stopped containers
docker rm -f $(docker ps -aq)

# Create a new bash process inside the container and connect it to the terminal
docker exec -it <container_id> bash

# Print the last lines of a container’s logs
docker logs --tail 100 <container_id> | less

$ image_id: docker images --- --headers 1 --column 3
$ container_id: docker ps --- --headers 1 --column 1