-: Now for working with images and containers,
we got a couple of core commands
which you should keep in mind.
Of course there is docker build,
and docker build can be used to build an image
based on a Dockerfile.
We specify a Build Context,
so the path to the folder
which contains the Dockerfile
and the folder in which
this image should be built
and we can also give our image a name
and a tag to ensure
that we can easily identify and use it
to make it unique and with the tag system,
we can also version our image.
And we can have one image category so to say
and then have different sub versions of that same image
in that category.
Like for the official node image,
where we have the 12 and 14 tag
to draw up different versions of Node JS
If we use one at the same image
with a different tag.
That's the idea here.
We then can run an image as a container
with the Docker run command,
there we could give this container a name,
with dash dash name,
we can auto remove it
when it's stopped with dash dash RM,
and we can run it in detached mode with dash D.
Of course, there are more options we can set
which you also saw throughout this course.
But these are some of the most important
and commonly used ones.
When we run a container,
we also need to provide the name and tag of an image
on which this container should be based
because the container always needs to be based on an image.
We then also can share images with Docker push
and Docker pull.
And there we just have to keep in mind
that the image name, now needs to be the name
of the repository on DockerHub.
You can also use our repository standard DockerHub.
In that case,
the image name would be the full URL
to that repository on that other registry.
But with DockerHub
it's enough if your image name
is your account name slash
and then your image name
and you need to label your images such locally
on your local machine
so that you can then push them.
Of course that's also something we saw
in detail throughout this course.