Docker engine Flashcards

1
Q

How do you run a container in detached mode (in the background)

A

docker run -d

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

How do you name a docker container when being run?

A

docker run –name

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

How do you specify whether a container should be automatically restarted?

A

docker run –restart=

options: no, on-failure, always, unless-stopped

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

How do you publish ports (exposing a containers port by mapping it to the host)?

A

docker run -p :

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

How do you automatically remove a container once stopped?

A

docker run –rm

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

How do you limit the memory a container uses?

A

docker run –memory
docker run –memory-reservation
* memory-reservation is a soft limit if memory contention on host

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

How do you list all running containers?

A

docker container list

docker ps

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

How do you list all containers?

A

docker container list -a

docker ps -a

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

How do you stop a container?

A

docker container stop

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

How do you remove a container?

A

docker container rm

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

How do you remove a running container?

A

docker container rm -f

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