List of key notes about building and using Docker images

Here I gathered answers to small pitfalls which from time to time appears because you’re not doing some actions often. Such actions include using of .dockerignore, mounting files, SSL certificates for web servers in containers, etc.

Building of Docker images

  1. The file want be applied if it’s not located in the same directory where you run docker build command.
  2. Building of an image will fail if you use specific file names which you are ignoring. For example, if you write in Dockerfile COPY filetoignore.txt . and you are ignoring such file(s) in .dockerignore, you’ll get an error
  3. Paths inside Dockerfile are relative to the folder where you’re running command docker build and not to the one where your Dockerfile is located.
  4. Relative paths should use only current or child folders, since the parent one (or through it) is out of Docker context during building.


  1. If you mount a file, but it’s not found in the host system, it will be mounted as a directory.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Post

%d bloggers like this: