docker-mailserver/docs/content/examples/tutorials/docker-build.md
Georg Lauterbach 98279e52b3
docs: add note about Docker version when building (#2799)
* add note about Docker version when building
* add note about `DOCKER_BUILDKIT` and build arguments
* provide link to COPY command
2022-09-28 09:25:07 +02:00

1.7 KiB

title
Tutorials | Docker Build

Building your own Docker image

Submodules

You'll need to retrieve the git submodules prior to building your own Docker image. From within your copy of the git repo run the following to retrieve the submodules and build the Docker image:

git submodule update --init --recursive
docker build -t mailserver/docker-mailserver .

Or, you can clone and retrieve the submodules in one command:

git clone --recurse-submodules https://github.com/docker-mailserver/docker-mailserver

Retrieving the git submodules will fix the error:

COPY failed: file not found in build context or excluded by .dockerignore: stat target/docker-configomat/configomat.sh: file does not exist

About Docker

Version

We make use of build-features that require a recent version of Docker. Depending on your distribution, please have a look at the official installation documentation for Docker to get the latest version. Otherwise, you may encounter issues, for example with the --link flag for a #!dockerfile COPY command.

Environment

If you are not using make to build the image, note that you will need to provide DOCKER_BUILDKIT=1 to the docker build command for the build to succeed.

Build Arguments

The Dockerfile takes additional, so-called build arguments. These are

  1. VCS_VERSION: the image version (default = edge)
  2. VCS_REVISION: the image revision (default = unknown)

When using make to build the image, these are filled with proper values. You can build the image without supplying these arguments just fine though.