Ref: https://learn.cantrill.io/courses/docker-fundamentals/lectures/44660838 =OR= https://www.youtube.com/watch?v=cB4VKZI2sVw
DEMO: https://learn.cantrill.io/courses/docker-fundamentals/lectures/44660840 =OR= https://www.youtube.com/watch?v=snXchrxRoPc → GitHub: https://github.com/acantril/docker-fundamentals/blob/main/build-a-simple-containerized-application/build-a-simple-containerized-application.md
docker build -t <TAG> <Dockerfile_path>
<Dockerfile_path>
to build a new image<Dockerfile_path>
can be e.g. current working directory, i.e. .
<TAG>
FROM
- set the base image for a build
LABEL
- add metadata to an image
RUN
- run commands in a new layer
COPY
- copy files/directories from source directory in client machine to destination directory inside new image layerADD
- like COPY
, but source can be a remote URL and additional extraction can be done
CMD
- set default executable of a container & arguments
docker run
commandENTRYPOINT
- same as CMD
, but can't be overridden
CMD
and ENTRYPOINT
can be used in the same Dockerfile
CMD
indicates the default parameters for ENTRYPOINT
FROM nginx:latest
LABEL [maintainer="[email protected]](mailto:maintainer=%[email protected])"
COPY 2048 /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
nginx
image
maintainer