# Docker Container

# Advantage of using docker-compose file version 3 over a shellscript?

docker compose

  1. Multiple inherited YAML files
  2. Automatically handles clearnup
  3. Redability, write less code

Shell script

  1. Able to use shell magic

# Dockerfile References


ARG user1=someuser
LABEL version="1.0"
ENV myName John Doe

ADD --chown=55:mygroup files* /somedir/
COPY hom?.txt /mydir/

<!-- The VOLUME instruction creates a mount point with the specified name and marks it as
     holding externally mounted volumes from native host or other containers. -->
VOLUME ["/var/www", "/var/log/apache2", "/etc/apache2"]
EXPOSE 80/tcp 443
USER ${user:-some_user}:group

WORKDIR /path/to/workdir

<!-- when the image is used as the base for another build. -->
ONBUILD RUN /usr/local/bin/python-build --dir /app/src

SHELL ["executable", "parameters"]
RUN uname -a

HEALTHCHECK --interval=5m --timeout=3s \
  CMD curl -f http://localhost/ || exit 1

ENTRYPOINT ["top", "-b"]
CMD ["-c"]

What is the difference between RUN and SHELL directive? :

# References

  • or
  • Buy me a coffeeBuy me a coffee