I have made a golang app using sample example, however when I setup docker to build and run it it fails to build giving the error
ERROR: for goserver Cannot start service goserver: b'OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \\"./app\\": stat ./app: no such file or directory": unknown'
My Dockerfile is
FROM golang:1.8
WORKDIR /usr/src/app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o ./app .
ENTRYPOINT ["./app"]
and my docker-compose is
version: '2'
volumes:
app_nm:
driver: local
services:
goserver:
container_name: "goserver"
image: "mygoserver"
build:
context: ./First
dockerfile: Dockerfile
volumes:
- ./First:/usr/src/app
ports:
- 8081:8080
tty: true
I tried logging into container via docker exec by setting tty: true and executing the build command and it works fine. What could be the issue?