So I have this folder
In which I run (using Powershell)
Get-Content Dockerfile | docker build –
But I get the following error :
=> ERROR [8/8] COPY docker-entrypoint.sh /
0.0s
------
> [8/8] COPY docker-entrypoint.sh /:
------
failed to compute cache key: "/docker-entrypoint.sh" not found: not found
This obviously has something to with an absolute path problem, but what is the intended fix for this ? I’ve tried multiple things from stackoverflow without success (changing CRLF to LF, using . instead of /, etc).
Thanks.
2
Answers
When you build using
docker build -
there is no build context and you can’t use COPY or ADD, unless they copy from a URL.You need a context, so you should use
instead.
More info here https://docs.docker.com/engine/reference/commandline/build/#build-with–
If docker reads the Dockerfile from stdin, then no build dir is set:
https://github.com/moby/moby/issues/19197#issuecomment-170156329
I’d suggest using
docker build .
instead to read the Dockerfile from the current directory.