Add Files to an Image

Creating a custom image only requires a Dockerfile with a FROM directive, but since this only renames the image, how do we actually change it? When building a custom image, we often need to add files. Whether they are config files, scripts, compressed archives, or even application binaries, Docker makes it easy to add a file to an image with just one directive.

In this tutorial, we'll:

  • Describe how to position files relative to your Dockerfile
  • Use the COPY directive to add local files
  • Download remote files using the ADD directive