Docker Community Forums

Share and learn in the Docker community.

Docker build - error checking context

Is this a bug or something else?

If I make a simple Dockerfile called Dockerfile.df and place it in my homedirectory, then
I will get this error message:

$ pwd
$  docker image build --tag ubuntu-git -f Dockerfile.df .
error checking context: 'no permission to read from '/home/mm/linuxjournal/issues/secure_file''.

Why is Docker trying to read a subdirectory?

However if I place the same Dockerfile.df in a empty directory, then it builds the image without problems.

The contains of the Dockerfile.df is:

FROM ubuntu:latest
LABEL maintainer=""
RUN apt-get update && apt-get install -y git 

Versions used:

$ docker --version
Docker version 18.09.7, build 2d0083d

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic

Thanks for any advise.

Apparently docker build tries to consider every file in the current directory. In my case there were hidden files owned by root which I had to remove first.