title: Dockerfile: Error response from daemon: OCI runtime create failed: container_linux.go:349
body: <p>I am following directory structure based on:
  <a href="https://github.com/golang-standards/project-layout" rel="nofollow noreferrer">https://github.com/golang-standards/project-layout</a></p>
  <p>I have created very simple app and basically I want to containerize it.
  Basically I have two files there. server.go which is definition of http endpoint and main file which starts server called main.go under cmd/webserver.</p>
  <p>Directory of this project looks like:</p>
  <pre><code>./
  ├── cmd
  │   └── webserver
  │       └── main.go
  ├── Dockerfile
  ├── go.mod
  └── server.go
  </code></pre>
  <p>go.mod</p>
  <pre><code>module github.com/geborskimateusz/auth
  
  go 1.15
  </code></pre>
  <p>a Dockerfile looks like this</p>
  <pre><code>FROM golang:alpine
  
  # Set necessary environmet variables needed for our image
  ENV GO111MODULE=on \
      CGO_ENABLED=0 \
      GOOS=linux \
      GOARCH=amd64
  
  # Move to working directory /build
  WORKDIR /build
  
  # Copy and download dependency using go mod
  COPY go.mod .
  RUN go mod download
  
  # Copy the code into the container
  COPY . .
  
  # Build the application
  RUN go build -o main .
  
  # Move to /dist directory as the place for resulting binary folder
  WORKDIR /dist
  
  # Copy binary from build to main folder
  RUN cp /build/main .
  
  # Export necessary port
  EXPOSE 3000
  
  # Command to run when starting the container
  CMD [&quot;/dist/main&quot;]:
  </code></pre>
  <p>Build is successful but the problem is that when I run
  <strong>docker run -p 3000:3000 geborskimateusz/auth</strong> I got:</p>
  <pre><code>docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused &quot;exec: \&quot;/dist/main\&quot;: permission denied&quot;: unknown.
  ERRO[0000] error waiting for container: context canceled 
  </code></pre>
  <p>What am I missing? I assume that maybe I need to cd in Dockerfile into cmd/webserver where main.go (executable file) is placed.</p>