I was trying to build my Docker image for my Gatsby Application. Whenever I run the command docker build . -t gatsbyapp, it gives me an error:
f
Was facing the same issue despite naming the file as Dockerfile. I restarted the docker and it worked for me. So, please try the same. Thanks!
I had this issue while trying to build my container running inside Windows Subsystem for Linux (WSL) and all I had to do was close the terminal and reopen my window and my issue was solved.
In my case I was trying to copy over wp-content from my current directory, inside the docker image I was building. Like so:
FROM wordpress:latest
# Copy wp-content
COPY ./wp-content/ ./var/www/html/wp-content/
However, I noticed that I had a .dockerignore file, which explicitly was told to ignore wp-content.
When I removed wp-content/ from .dockerignore it worked fine.
In my case, I had two problems:
After these two adjustments, all worked as expected.
I had the same issue and all I had to do was to capitalize the docker configuration filename
dockerfile > didn't work
Dockerfile > did work
Make sure you .dockerignore doesn't match your file.