Who is maintaining the container?
MAINTAINER your name <firstname.lastname@example.org>
WORKDIR: all subsequent actions will be executed in that working directory.
ADD, COPY: add files to the image filesystem
COPY: lets you copy a local file or directory from your host (the machine from which you are building the image)
ADD: same, but ADD works also for URLs, and for .tar archives that will be automatically extracted upon being copied.
# COPY source destination COPY ~/.bashrc .
ENV, ARG: run and build environment variables
Difference between ARG and ENV explained here.
CMD, ENTRYPOINT: command to execute when generated container starts
The ENTRYPOINT specifies a command that will always be executed when the container starts. The CMD specifies arguments that will be fed to the ENTRYPOINT.
In the example below, when the container is run without an argument, it will execute
echo "hello world".
If it is run with the argument nice it will execute
FROM ubuntu:18.04 ENTRYPOINT ["/bin/echo"] CMD ["hello world"]
A more complex recipe (save it in a text file named Dockerfile:
FROM ubuntu:18.04 MAINTAINER Toni Hermoso Pulido <email@example.com> WORKDIR ~ RUN apt-get update && apt-get -y upgrade RUN apt-get install -y wget ENTRYPOINT ["/usr/bin/wget"] CMD ["https://cdn.wp.nginx.com/wp-content/uploads/2016/07/docker-swarm-hero2.png"]