Click here to view code image
$ docker container rm test-nginx
test-nginx
$ docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Deleted Containers:
a583eac3cadbafca855bec9b57901e1325659f76b37705922db67ebf22fdd925
Dockerfiles
A Dockerfile is a script that is used to create a container
image to your specifications. It is an enormous time
saver and provides a ready-made system for replicating
and automating container deployments. Once you have
built a Dockerfile, you can create an infinite number of
the same images without having to manually edit or
install software. A Dockerfile is simply a text file with a
structured set of commands that Docker executes while
building the image. Some of the most common
commands are as follows:
FROM: Selects the base image used to start the build process or can be
set to scratch to build a totally new image.
MAINTAINER: Lets you select a name and email address for the
image creator.
RUN: Creates image layers and executes commands within a
container.
CMD: Executes a single command within a container. Only one can
exist in a Dockerfile.
WORKDIR: Sets the path where the command defined with CMD is
to be executed.
ENTRYPOINT: Executes a default application every time a container
is created with the image.
ADD: Copies the files from the local host or remotely via a URL into
the container’s file system.