Creation Management Registry Flashcards

1
Q

What is the use of a Dockerfile

A

to create an image

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

What does the RUN command do

A

runs command on container at build time in a new layer

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

What is the purpose of the CMD instruction in the docker file

A

it is the default command that is started when a container is run

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

What is the purpose of LABEL?

A

adds metadata

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

What is the difference between ADD and COPY

A

COPY takes in a src and destination. It only lets you copy in a local file or directory from your host

ADD lets you do that too, but it also supports 2 other sources. First, you can use a URL instead of a local file / directory. Secondly, you can extract a tar file from the source directly into the destination.

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

Identify and display the main parts of a Dockerfile.

A

FROM creates a layer from the given image
COPY copies src into container
RUN runs a command in the container
CMD specifies what command to run within the container

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

Pull an image

A

docker image pull IMAGE

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

List images

A

docker image ls

docker image ls -a

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

Remove an image

A

docker image rm IMAGE

docker image rm -f IMAGE

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

What does docker image prune do

A

removes “dangling” images (images that have no relationship to tagged images)

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

How to inspect an image

A

docker image inspect IMAGE

docker image inspect IMAGE –format {{go template}}

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

How do you tag an image

A

Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE

docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]

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

Apply a file to create a Docker image.

A

docker image build

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

How to display layers of a Docker image

A

docker image history

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

How to modify an image to a single layer.

A

docker export flat_container > flat.tar

cat flat.tar | docker import - flat:latest

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

Deploy a registry

A

docker run -d -p 5000:5000 –restart=always –name registry registry:2

17
Q

Log into a registry

A

docker login default is docker hub

18
Q

Push to a registry

A

docker tag ubuntu /ubuntu

docker push /ubuntu

19
Q

Search a registry

A

docker search

20
Q

Sign an image in a registry.

A

docker trust key generate
docker trust key load key.pem –name jeff

docker trust signer add –key cert.pem jeff registry.example.com/admin/demo

docker trust sign registry.example.com/admin/demo:1