Difference between revisions of "Dockerfile"
Jump to navigation
Jump to search
↑ https://en.wikiversity.org/wiki/DevOps/Docker/Dockerfile
↑ https://kapeli.com/cheat_sheets/Dockerfile.docset/Contents/Resources/Documents/index
(34 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | Dockerfile is a text file where you define instructions used to create your Docker images, check official Dockerfile Reference documentation: https://docs.docker.com/engine/reference/builder/<ref>https://en.wikiversity.org/wiki/DevOps/Docker/Dockerfile</ref> | + | <code>Dockerfile</code> is a text file where you define instructions used to create your Docker images, check official Dockerfile Reference documentation: https://docs.docker.com/engine/reference/builder/<ref>https://en.wikiversity.org/wiki/DevOps/Docker/Dockerfile</ref> |
For creating this file with instructions usually called Dockerfile you can use the following keywords<ref>https://kapeli.com/cheat_sheets/Dockerfile.docset/Contents/Resources/Documents/index</ref>: | For creating this file with instructions usually called Dockerfile you can use the following keywords<ref>https://kapeli.com/cheat_sheets/Dockerfile.docset/Contents/Resources/Documents/index</ref>: | ||
− | * ADD | + | * <code>[[ADD]]</code> |
− | * ARG | + | * <code>[[ARG]]</code> |
− | * [[CMD]] | + | * <code>[[CMD]]</code> for executing containers. https://docs.docker.com/engine/reference/builder/#cmd |
− | * COPY | + | * <code>[[COPY]]</code> |
− | * [[ENTRYPOINT]]: https://docs.docker.com/engine/reference/builder/#entrypoint | + | * <code>[[ENTRYPOINT]]</code>: https://docs.docker.com/engine/reference/builder/#entrypoint |
− | * ENV | + | * <code>[[ENV]]</code> |
− | * [[EXPOSE]] | + | * <code>[[EXPOSE]]</code> |
− | * FROM https://docs.docker.com/engine/reference/builder/#from | + | * <code>[[FROM]]</code> https://docs.docker.com/engine/reference/builder/#from |
* [[HEALTHCHECK]] https://docs.docker.com/engine/reference/builder/#healthcheck (>= [[Docker 1.12]]) | * [[HEALTHCHECK]] https://docs.docker.com/engine/reference/builder/#healthcheck (>= [[Docker 1.12]]) | ||
* LABEL | * LABEL | ||
* ONBUILD | * ONBUILD | ||
− | * RUN: https://docs.docker.com/engine/reference/builder/#run | + | * <code>[[RUN]]:</code> https://docs.docker.com/engine/reference/builder/#run |
* SHELL | * SHELL | ||
* STOPSIGNAL | * STOPSIGNAL | ||
− | * USER | + | * <code>[[USER]]</code>:</code> https://docs.docker.com/engine/reference/builder/#user |
* [[VOLUME]], creates a [[mount point]] | * [[VOLUME]], creates a [[mount point]] | ||
* WORKDIR | * WORKDIR | ||
Line 24: | Line 24: | ||
# Read Understand how CMD and ENTRYPOINT interact https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact | # Read Understand how CMD and ENTRYPOINT interact https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact | ||
# Learn about [[start configuration behavior and restart policy]] | # Learn about [[start configuration behavior and restart policy]] | ||
− | # Learn | + | # Learn how to use <code>.[[dockerignore]]</code> file |
− | # Read Dockerfile best practices https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ | + | # Read <code>Dockerfile</code> best practices https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ |
== Related terms == | == Related terms == | ||
+ | * [[Dockerfile examples]] | ||
+ | * <code>[[docker build]]</code> | ||
+ | * <code>[[docker-compose build]]</code>, <code>[[image]]:, [[build:]], [[dockerfile:]], [[args:]]</code> | ||
* [[Docker Engine release notes]] | * [[Docker Engine release notes]] | ||
* [[BuildKit]] Dockerfile-agnostic builder toolkit | * [[BuildKit]] Dockerfile-agnostic builder toolkit | ||
− | * <code>[[docker start]]</code> | + | * <code>[[docker start]]</code>, <code>[[docker run]]</code> |
− | * <code>[[ | + | * [[Buildpack]] |
− | * <code>[[ | + | * <code>[[.dockerignore]]</code> |
− | * [[ | + | * <code>[[Makefile]]</code> |
+ | * [[Caddyfile]] | ||
== See also == | == See also == | ||
+ | * {{Dockerfile}} | ||
+ | * {{docker build}} | ||
* {{docker-compose}} | * {{docker-compose}} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:Docker]] | [[Category:Docker]] |
Latest revision as of 17:41, 22 February 2024
Dockerfile
is a text file where you define instructions used to create your Docker images, check official Dockerfile Reference documentation: https://docs.docker.com/engine/reference/builder/[1]
For creating this file with instructions usually called Dockerfile you can use the following keywords[2]:
ADD
ARG
CMD
for executing containers. https://docs.docker.com/engine/reference/builder/#cmdCOPY
ENTRYPOINT
: https://docs.docker.com/engine/reference/builder/#entrypointENV
EXPOSE
FROM
https://docs.docker.com/engine/reference/builder/#from- HEALTHCHECK https://docs.docker.com/engine/reference/builder/#healthcheck (>= Docker 1.12)
- LABEL
- ONBUILD
RUN:
https://docs.docker.com/engine/reference/builder/#run- SHELL
- STOPSIGNAL
USER
: https://docs.docker.com/engine/reference/builder/#user- VOLUME, creates a mount point
- WORKDIR
Activities[edit]
- Learn differences between RUN and CMD or ENTRYPOINT: https://stackoverflow.com/a/25150809
- Read Understand how CMD and ENTRYPOINT interact https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact
- Learn about start configuration behavior and restart policy
- Learn how to use
.dockerignore
file - Read
Dockerfile
best practices https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
Related terms[edit]
- Dockerfile examples
docker build
docker-compose build
,image:, build:, dockerfile:, args:
- Docker Engine release notes
- BuildKit Dockerfile-agnostic builder toolkit
docker start
,docker run
- Buildpack
.dockerignore
Makefile
- Caddyfile
See also[edit]
Dockerfile: FROM, RUN, CMD, ENTRYPOINT, WORKDIR, COPY, ADD, USER, ENV, ARG, HEALTHCHECK
,hadolint, LABEL, EXPOSE
docker build [ --tag | --platform | --help ] FROM, Dockerfile, .dockerignore, requirements.txt, docker build --help, docker tag
docker-compose
,docker-compose.yml
: [services
|volumes
|networks
|up
|down
|restart
|logs
|create
|changelog
|version
|secrets
|config
|-v
|-h
|exec], docker-compose pull
,Environment:
, Docker-compose.yml examples,.env
, release notes, expose:, docker-compose --env-file,services.deploy.resources
Advertising: