Image Creation, Management and Registry Flashcards

1
Q

Using ADD vs curl/wget from URL in Dockerfile?

A

ADD for every URL will create multiple layers, increasing size

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

What does EXPOSE directive do in Dockerfile?

A

Documents the port that the service runs on, does not actually expose the port

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

Syntax for HEALTHCHECK in Dockerfile?

A

HEALTHCHECK –interval=5s CMD ping -c localhost:80

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

ENTRYPOINT vs CMD in Dockerfile?

A

ENTRYPOINT cannot be overwritten, extra commands passed when running container will append to the ENTRYPOINT command.
CMD can be overwritten

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

Syntax for setting environment vars, dockerfile and cli?

A

ENV KEY VALUE

–env (-e) key1=value1

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

How to tag docker image during build and after build?

A

docker build -t nginx

docker image tag

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

How to commit running container with changes to a new image?

A

docker container commit

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

How to make changes to a container commit?

A

With the –change flag

docker container commit –change=’CMD [“bin/sh”]’

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

How to see the layers of a docker image?

A

docker image inspect

docker image history

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

How to filter the docker image inspect command?

A

–format=’{{.Id}}’

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

How to flatten a docker image?

A
  1. Run container off image
  2. docker container export my_container > file.tar
  3. cat file.tar > docker image import - my_new_image:latest
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How to filter a search for images from dockerhub?

A

docker image search –filter “is-official=true” ubuntu

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

How to limit the number of results returned by docker image search?

A

docker image search –limit 10 ubuntu

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

How to move an image from one host to another?

A
  1. docker image save ubuntu > ubuntu.tar

2. docker image load < ubuntu.tar

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

What does cache do when building docker images?

A

A specific docker instruction (like a RUN, CMD) can be cached from previous image builds. All layers subsequent to a non-cached layer won’t be served from cache either.

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