DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1

The build is successful. You can see that with the -t flag,
you can set a name that can be used to call the image
more easily. The. at the end of the command tells
Docker to look for the Dockerfile in the local directory.
You could also use the -f flag with a path to the location
of Dockerfile file, if it is not in your current directory.
Docker also accepts a URL to the Dockerfile, such as at
GitHub. As shown in this example, the name Dockerfile
must be capitalized and one word.


When an image is built, you can use docker image ls to
see it in local storage:


Click here to view code image


$ docker image ls
REPOSITORY TAG IMAGE ID CREATED
SIZE
myimage latest 04ae8c714993 48 minutes
ago 154MB

You can use a number of commands to get information
from your images. The first is inspect. Entering docker
image inspect myimage, as shown in Example 13-7,
gets all the details about the image, including its layer
structure.


Example 13-7 docker image inspect Command

Click here to view code image


$ docker image inspect myimage
[
{
"Id":
"sha256:04ae8c7149937b2ce8b8963d6c34810d8dc53607c9a97064e1f3c85cdc3
abb46",
"RepoTags": [
"myimage:latest"
],
"RepoDigests": [],
"Parent":
"sha256:2ecd13c5af2b41349b58f2397cbbbc70f5c1c604262113bae443f1f6fc
3758cc",
"Comment": "",
Free download pdf