Docker2 Flashcards

1
Q

run a container with a command and argument

A

docker run nginx echo hello world.

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

list all containers

A

docker ps -a

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

what is the difference between a container and an image?

A

when a container is created from an image, it adds a new writable layer on top of the image layers. This is called ‘container layer’. the major difference between a container and an image is the top container layer.

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

explain this command docker run -d - -name app1 httpd

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

command to display detailed information of a container.

A

docker inspect [container name]

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

pause a container

A

docker pause [cont name]

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

unpause a container

A

docker unpause [cont name]

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

pull an image

A

docker pull [image name]

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

inspect an image

A

docker inspect [image name]

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

what is a Dockerfile?

A

a set of instructions used to build an image.

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

what are some frequently used docker file instructions?

A

FROM: sets the parent image
LABEL: adds metadata to the image
EXPOSE: intend port to publish
CMD: setting default command that will run in the container. It can be overridden
ENTRYPOINT: the entry point in a Dockerfile defines what the container should do when it starts, it does not get overridden.
WORKDIR: sets current working directory
COPY: copy files from one location to the container
ENV: sets environment variables
USER: sets user

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

what are the two types of storage ?

A

non persistent: data resides withing the cont, gets deleted when container is deleted, all containers have it by default
persistent: data does not reside within the container, does not get deleted when the container is deleted

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

what is the syntax to mount volume to a container?

A

docker run -d - -name [cont name] -v [volume name]:/usr/local/apache2/htdocs/ httpd

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