Beruflich Dokumente
Kultur Dokumente
If you get permission denied error, then you’ll need to use sudo with the commands below.
If you don’t like to type sudo each time, you may add your user to the docker group in your
Linux system.
docker --version
2. To find out detailed docker versioning information in your system for both client and
server:
docker version
docker image ls
docker images
docker images -a
8. To exit a docker container from interactive mode and stop the container
docker container ls
docker ps
docker ps -a
12. To attach to a running container (get access to shell from host terminal)
13. To stop a docker container. Stopping a container doesn’t result in loss of data stored
inside the container.
15. To permanently remove a docker container. This will result in the loss of data held stored
inside the container.
17. Create a docker container in interactive mode, give it a custom name, and publish the
port
18. Dockerfile
a. FROM <image>:<tag>
i. This is the base image used to build our image
b. LABEL <key>=<value>
i. The LABEL instruction adds metadata to an image. A LABEL is a
key-value pair.
d. RUN
i. The RUN instruction will execute any commands in a new layer on top of
the current image and commit the results. The resulting committed image
will be used for the next step in the Dockerfile.
e. WORKDIR </path>
i. The WORKDIR instruction sets the working directory for any RUN, CMD,
ENTRYPOINT, COPY and ADD instructions that follow it in the
Dockerfile. If the WORKDIR doesn’t exist, it will be created even if it’s not
used in any subsequent Dockerfile instruction.
f. ENV <key>=<value>
i. The ENV instruction sets the environment variable <key> to the value
<value>.
g. EXPOSE <port>
i. The EXPOSE instruction informs Docker that the container listens on the
specified network ports at runtime.
h. ENTRYPOINT
i. An ENTRYPOINT allows you to configure a container that will run as an
executable.