Search code examples
dockerubuntudockerfilewebstorm

Failed to deploy Dockerfile: path/to/Dockerfile': ADD failed temp/path/to/app :: no such file or directory


I'm trying to run a Dockerfile which I cloned from https://github.com/aws-samples/ecs-refarch-cloudformation using Webstorm on an Ubuntu 18.0.4 machine. When I'm trying to run ./services/product-service/src/Dockerfile, I'm getting an error as below.

Step 5/6 : ADD app /app

Error: ResponseItem.ErrorDetail[code=<null>,message=ADD failed: stat /var/lib/docker/tmp/docker-builder865139225/app: no such file or directory]
Failed to deploy '<unknown> Dockerfile: services/product-service/src/Dockerfile': ADD failed: stat /var/lib/docker/tmp/docker-builder865139225/app: no such file or directory

Given below is the Dockerfile

# Start from a small base
FROM scratch

# Our application requires no privileges
# so run it with a non-root user
ADD users /etc/passwd
USER nobody

# Our application runs on port 8001
# so allow hosts to bind to that port
EXPOSE 8001

# Add our application binary
ADD app /app

# Run our application!
ENTRYPOINT [ "/app" ]

Disclaimer :

I tried a few fixes as given,

here : ADD failed : No such file/Directory while building docker image

here : https://github.com/goreleaser/goreleaser/issues/694

here : https://github.com/docker/for-win/issues/1859

Some of them were not relevant to my case.


Solution

  • I just created a directory the app directory in ../src and commented out USER nobody line in Dockerfile, and it seems working fine.