I am having trouble building a Go-based Docker project. My overall directory structure looks like:
api-gateway
│ ├─handler
│ └─resource
--Dockerfile
My Dockerfile contains:
FROM alpine:3.2
ADD api-gateway /api-gateway
ADD resource/pri_key.pem resource/pub_key.pem /resource/
#ADD resource/ca-certificates.crt /etc/ssl/certs/
VOLUME /resource/
ENTRYPOINT [ "/api-gateway" ]
Even though I'm using ADD to include a file in the image, I'm still getting an error. api-gateway is a directory that includes the Dockerfile inside.
D:\FileWithDocument\ExtraCodeProject\shop-micro-master>docker-compose up
Building api-gateway
Step 1/5 : FROM alpine:3.2
---> 98f5f2d17bd1
Step 2/5 : ADD api-gateway /api-gateway
ERROR: Service 'api-gateway' failed to build: ADD failed: stat /var/lib/docker/tmp/docker-builder931060141/api-gateway: no such file or directory
I use Docker Desktop in Windows. Docker Engine version is:
Client: Docker Engine - Community
Version: 18.09.2
API version: 1.39
Go version: go1.10.8
Git commit: 6247962
Built: Sun Feb 10 04:12:31 2019
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.2
API version: 1.39 (minimum version 1.12)
Go version: go1.10.6
Git commit: 6247962
Built: Sun Feb 10 04:13:06 2019
OS/Arch: linux/amd64
Experimental: true
When i download the github project and run docker build, it still outputs this error.
ERROR: Service 'api-gateway' failed to build: ADD failed: stat /var/lib/docker/tmp/docker-builder931060141/api-gateway: no such file or directory
ADD resource/..., then you writeVOLUME /resource/are you sure is the same path? one path start with/and the other one no. - Pablo López Gallego