Mentor Cloud Devops - docker Flashcards

1
Q

What is the docker build command

A

The docker build command builds Docker images from a Dockerfile and a “context”.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Build an image from the Dockerfile in the

current directory and tag the image

A

docker build -t myimage:1.0 .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

List all images that are locally stored with

the Docker Engine

A

docker image ls

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Delete an image from the local image store

A

docker image rm alpine:3.4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

References

A

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/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

List the running containers

A

docker container ls –all

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Delete all running and stopped containers

A

docker container rm -f $(docker ps -aq)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Stop a running container through SIGKILL with name web

A

docker container kill web

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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.

A

docker container run –name web -p

5000:80 alpine:3.9

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Remove all images

A

docker rmi $(docker images -q)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

run a container and run the bash app so that the container keeps running

A

docker run -i -t image /bin/bash

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Connect to a running container

A

docker exec -it container /bin/bash

How well did you know this?
1
Not at all
2
3
4
5
Perfectly