The first file you will use is the
Dockerfile. Enter the
shellhttpd folder and move the
cd shellhttpd mv ../shellhttpd.disabled/Dockerfile .
Dockerfile contains all the commands a user would call on the command line to assemble
a container image.
Dockerfile usually starts from a base image. The base image could be a distribution such as
Alpine, Debian, or Ubuntu or it could be a distribution already prepared for a specific
application like Python, NGINX.
Think of the
Dockerfile as your way of customizing the base image.
For more information, see the Dockerfile Reference
Check the content of your
FROM alpine COPY httpd.sh /usr/local/bin/ CMD ["/usr/local/bin/httpd.sh"]
Dockerfile is very simple and a great way to get started.
The first line creates a layer from the latest Alpine Docker image. This means that your final image contains all the files provided by this image plus your additions.
Your first customization is in the second line.
COPY adds files from your Docker client’s
current directory to your Docker image. In this case, you will copy the shell script
httpd.sh to the
/usr/local/bin/ directory of your Docker image.
Last but not least there is
CMD, these are arguments for the
ENTRYPOINT. In this example,
there is no
ENTRYPOINT specified because the default entrypoint is enough.
The default entrypoint is
/bin/sh -c and by passing
are configuring the image to execute the command line:
/bin/sh -c /usr/local/bin/httpd.sh
when you run the container.