Docker Flashcards

1
Q

command to build a docker image

A

docker build -t friendlyhello (image name)

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

run docker image and map port 80 from within the container to 4000

A

docker run -p 4000:80 friendlyhello

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

docker run the image in background )giving back the command prompt) plus map the port 80 from within the container to port 4000 outside.

A

docker run -p -d 4000:80 frendlyhello

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

list all running docker containers

A

docker container ls (old style docker ps)

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

list all containers even those not running

A

docker container ls -a

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

gracefully stop a container

A

docker stop container ID

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

forcefully shutdown a container

A

docker container kill

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

remove a specified container from this machine

A

docker container rm

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

list all images on this machine

A

docker image ls

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

remove a specified image from this machine

A

docker image rm

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

create a tag for an image docker

A

docker tag username/repository:tag

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

push the tagged image to the registry

A

docker push username/repository:tag

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

run the tagged image from the repo

A

docker run username/repository:tag

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

run a service consisting of multiple containers (tasks)

A

docker stack deploy -c docker-compose.yml appName

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

take down the app/ service

A

docker stack rm appName

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

take down the swarm

A

docker swarm leave –force

17
Q

start a container? Is state preserved from the previous session?

A

docker start ContainerID