docker - 2015/05/15 07:30:34 exec: "go": executable file not found in $PATH -
i facing below issue tell me how fix this! command used:
$ sudo docker run --rm -p -p 9090:9090 --name trial godock & $ docker run --rm -p -p 9090:9090 --name trial godock2015/05/18 03:35:25 exec: "go": executable file not found in $path # go version go version go1.2.1 linux/amd64
docker file:
from ubuntu run apt-get -y update add server.go /src/server.go add . /src expose 9090 cmd ["go","run","/src/server.go"]
server.go:
package main import( "io" "net/http" "log" "fmt" ) func helloserver(w http.responsewriter, req * http.request) { io.writestring(w, "hello, world!\n") } func main() { fmt.println("starting server") http.handlefunc("/hello", helloserver) err: = http.listenandserve(":9090", nil) if err != nil { log.fatal("listenandserve: ", err) } }
please me resolve issue..
install go in container
you mention file similar this:
from ubuntu run apt-get -y update add server.go /src/server.go add . /src expose 9090 cmd ["go","run","/src/server.go"]
amend run
command read following install go tools:
run apt-get update && apt-get install -y golang
invoke go explicitly
you should reference go
command explictly full path in cmd
instruction @ end of docker file (see cmd reference).
amend cmd
of sample dockerfile with:
cmd ["/usr/bin/go","run","/src/server.go"]
Comments
Post a Comment