gatsby-docker: Docker build fails on the first line

I am getting the following error
Sending build context to Docker daemon 1.384MB
Step 1/3 : FROM gatsbyjs/gatsby:onbuild as build
# Executing 1 build trigger
ADD failed: stat /var/lib/docker/tmp/docker-builder611750273/public: no such file or directory
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 13
- Comments: 16
This issue is still reproducible and prevents new users from being able to make use of the docker image.
Steps to reproduce:
This results in:
I totally agree with this. My solution was to build the image and host it in docker hub. If someone wants to use it as well, just replace
FROM gatsbyjs/gatsby:onbuild as build
withFROM masasip/gatsby:onbuild as build
To repleat my steps and host image on your own, create a repo to docker hub and then run locally:
and replace
FROM gatsbyjs/gatsby:onbuild as build
with<your-docker-hub-username>/<your-docker-hub-repo>:onbuild
I solved the problem by doing a custom Dockerfile based on nginx image. My Dockerfile and my nginx config are in this public gist https://gist.github.com/NogaMan/3ae6bd88e8ae063ab6da56bc36659c7d
The files are working 100%
I am pretty sure the problem is that the onbuild tag on docker hub contains the same image like the latest tag, which it should not. It is supposed to contain the result of https://github.com/gatsbyjs/gatsby-docker/blob/master/Dockerfile.onbuild but it does not. Instead both images are a result of https://github.com/gatsbyjs/gatsby-docker/blob/master/Dockerfile which is only supposed to be used for the latest tag. The issue @shicholas linked (#38) contains the right workarounds for this issue. (Another option is to use the Dockerfile.onbuild from this repo and build it yourself.)
Any news about fixing this bug?
hmm, I’m not sure what your issue is then. given that this docker image hasn’t been updated in a while, I shared a solution (and there are others) on this thread - https://github.com/gatsbyjs/gatsby-docker/issues/38#issuecomment-616043649 hope either solution listed can help