CLI Flashcards

1
Q

What is the command signature for running contianers?

A
docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the command to run a container in the background?

A
docker run -d=true imageName

or

docker run -d imageName
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the command to run a container with an interactive terminal?

A
docker run -it imageName
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the command to run a mongo container and use mongosh inside it?

A
docker run -d --name mongo-container mongo

docker exec -it mongo-container bash

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

What is the command to run a container with specific environment variables?

A
docker run -e "key=value" -e "foo=bar" imageName
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the command signature for building images?

A
docker build [OPTIONS] PATH
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the command to build an image from a git repository?

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

What command can be used to build an image with a tag that allows it to be pushed to a registry?

A
docker build -t username/repoName:tag .
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What command can be used to build a multi-architecture image and push the image to a registry?

A
docker buildx build --platform=linux/amd64,linux/arm64 --tag username/repository:version --push .
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the command signature for pulling images from a registry?

A
docker pull [OPTIONS] NAME:TAG
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the command signature for removing a container?

A
docker rm [OPTIONS] CONTAINER...
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the conmand signature for removing images?

A
docker rmi [OPTIONS] IMAGE...
How well did you know this?
1
Not at all
2
3
4
5
Perfectly