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.
- The file want be applied if it’s not located in the same directory where you run
docker build
command. - 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 - 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. - Relative paths should use only current or child folders, since the parent one (or through it) is out of Docker context during building.
- If you mount a file, but it’s not found in the host system, it will be mounted as a directory.