Last active
March 17, 2021 18:44
-
-
Save KomanRudden/9cbd0e4baacfde7948ce6e80567a4373 to your computer and use it in GitHub Desktop.
Docker commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker pull pull a pre-built image from the public repos | |
docker run run the container in one of 3 modes - Background, Foreground, Interactive | |
docker ps obtain a list of running containers | |
docker ps -a obtain a list of both running and stopped containers | |
docker images obtain a list of all images | |
docker rm remove container | |
docker container prune remove stopped containers | |
docker rmi remove image | |
docker logs view the logs of the running job | |
docker commit save the container state as an image | |
docker diff list of change in files and directories | |
docker build build docker images from dockerfiles | |
docker inspect low-level information about containers and images | |
docker attach interact with running containers | |
docker kill kill the main process of the container | |
Examples - pull, run, images | |
❯ docker pull hello-world | |
Using default tag: latest | |
latest: Pulling from library/hello-world | |
b8dfde127a29: Pull complete | |
Digest: sha256:308866a43596e83578c7dfa15e27a73011bdd402185a84c5cd7f32a88b501a24 | |
Status: Downloaded newer image for hello-world:latest | |
docker.io/library/hello-world:latest | |
❯ docker images | |
REPOSITORY TAG IMAGE ID CREATED SIZE | |
hello-world latest d1165f221234 11 days ago 13.3kB | |
❯ docker ps -a | |
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
afae50be3ea2 hello-world "/hello" 18 minutes ago Exited (0) 18 minutes ago crazy_margulis | |
❯ docker run hello-world | |
Hello from Docker! | |
❯ docker run -it busybox sh | |
/ # | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment