Docker撰写work_dir问题

I am trying to run a golang app using docker-compose, below is my compose configuration.

version: '2'
services:

    #Application container
    go:
        image: golang:1.8-alpine
        ports:
            - "80:8080"
        links:
            - mongodb
        environment:
            DEBUG: 'true'
            PORT: '8080'
        working_dir: /go/src/simple-golang-app
        command: go run main.go
        volumes:
            - ./simple-golang-app:/go/src/simple-golang-app

    mongodb:
        image: mvertes/alpine-mongo:3.2.3
        restart: unless-stopped
        ports:
            - "27017:27017"

On running the compose using command "docker-compose up" i get error "stat main.go: no such file or directory" even when main.go is available in working directory.

it works fine when your host dir layout is

oxo@thor ~/Dropbox/Documents/code/docker/golang_working_dir $ find .
.
./docker-compose.yaml
./simple-golang-app
./simple-golang-app/main.go

so here we

cd ~/Dropbox/Documents/code/docker/golang_working_dir
docker-compose up

for a more complex build involving dependancies I use a Dockerfile :

FROM golang:1.8-alpine

RUN mkdir -p /go/src/simple-golang-app/
COPY simple-golang-app/main.go   /go/src/simple-golang-app
WORKDIR  /go/src/simple-golang-app
RUN apk add --no-cache git mercurial && go get -v -t ./...  && apk del git mercurial
RUN go install ./...
RUN go build 

ENV PORT 9000

now update your docker-compose.yaml to use this new image :

old

image: golang:1.8-alpine

new

image: nirmal_golang_alpine:latest

so your commands are

docker build --tag nirmal_golang_alpine

docker-compose up