mkdir directory aaa
create file go_httpserver.go
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Welcome to my Website!!!\n %s", r.URL.Path[1:])
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe("0.0.0.0:80", nil)
}
set GOOS=linux
go build go_httpserver.go => get linux go program
2、create docker image
2.1 install docker toolbox Link
2.2 run kitematic then see left-down DOCKER CLI , click it, then
2.2.1 create directory bbb
2.2.2 create Dockerfile
ADD go_httpserver /
ENTRYPOINT ["/go_httpserver"]
docker buid -t testdockergoweb:v1 .
2.2.3 use kitematic left-up +NEW -> My Images -> CREATE just crate image
2.2.4 now Containers list have testdockergoweb running. see right-up Settings
-> Hostname / Ports -> change
DOCKER PORT 80
PUBLISHED IP:PORT port->3111
SAVE
then
click PUBLISHED IP:PORT list have bule link.
3、export docker image
in DOCKER CLI -> docker export testdockergoweb > testdockergoweb.tar