Mentor Cloud Devops - docker Flashcards
What is the docker build command
The docker build command builds Docker images from a Dockerfile and a “context”.
Build an image from the Dockerfile in the
current directory and tag the image
docker build -t myimage:1.0 .
List all images that are locally stored with
the Docker Engine
docker image ls
Delete an image from the local image store
docker image rm alpine:3.4
References
https: //www.docker.com/sites/default/files/d8/2019-09/docker-cheat-sheet.pdf
https: //dockerlabs.collabnix.com/docker/cheatsheet/
https: //docs.docker.com/engine/reference/commandline/logs/
https: //docs.docker.com/engine/reference/commandline/rm/
https: //dockerlabs.collabnix.com/docker/cheatsheet/
https: //www.freecodecamp.org/news/how-to-remove-images-in-docker/
List the running containers
docker container ls –all
Delete all running and stopped containers
docker container rm -f $(docker ps -aq)
Stop a running container through SIGKILL with name web
docker container kill web
Run a container from the Alpine version 3.9
image, name the running container
“web” and expose port 5000 externally,
mapped to port 80 inside the container.
docker container run –name web -p
5000:80 alpine:3.9
Remove all images
docker rmi $(docker images -q)
run a container and run the bash app so that the container keeps running
docker run -i -t image /bin/bash
Connect to a running container
docker exec -it container /bin/bash