pigfox
pigfox

Reputation: 1401

Standard_init_linux.go:211: exec user process caused “exec format error”

The following code generates an error: standard_init_linux.go:211: exec user process caused “exec format error”

Any pointers to what I’m doing wrong?

FROM golang:alpine AS builder
 
ENV GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOARCH=wasm GOOS=js

WORKDIR /build

COPY . .

COPY wasm_exec.js . 
COPY server.go . 
COPY main.wasm . 
COPY manifest.json . 
COPY sw.js . 
COPY wasm_exec.js . 
COPY app.js . 
COPY index.html .

EXPOSE 8989 
ENTRYPOINT ["./server.go"]

Upvotes: 2

Views: 1697

Answers (2)

feuyeux
feuyeux

Reputation: 1196

  1. To use dos2unix fix your files' format, which maybe changed by git from lf to crlf
  2. go build before copy to docker, then, copy and execute the bin
  3. if you don't want to do pre-built, the last line should be ENTRYPOINT ["go","run","./server.go"]

Upvotes: 2

Neeraj
Neeraj

Reputation: 174

The error is because you are trying to execute server.go file without compiling you need to compile server.go to get the executable which then can be used as executable.

go build server.go

Or you can directly run it using

go run server.go

Upvotes: 1

Related Questions