Essentials commands Flashcards

1
Q

List containers

A

docker container ls

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

List images running

A

docker image ls

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

Pull an image

A

docker image pull

docker image pull nginx

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

Return low level details from image

A

docker image inspect

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

List all commands pertain to container

A

docker container -h

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

Run busybox container

A

docker container run busybox

docker container run -d –name nginx –restart unless-stopped -p 8080:80 –memory 500M –memory-reservation 256M nginx

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

List all containers

List currently running containers

A

docker container ls -a

docker container ls

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

List container’s logs

A

docker container logs

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

List statistic for a container

A

docker container stats

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

Execute a command on a running container

A

docker container exec -it /bin/bash
after that you get into the shell of the container,
now you can run ls etc
exit command will not stop the container
or simply run:
docker container exec -it ls -al /usr/share/nginx/html/ to list html dir

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

Pause/unpause container

A

docker container pause

docker container unpause

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

Erase either stopped or running container

A

docker container rm -f

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

Remove all stopped containers

A

docker container prune

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

Run a container and makes this deleted after exiting

A

docker container run –rm busybox

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