[email protected]:~ $ cat hello.go
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
[email protected]:~ $ go build hello.go
[email protected]:~ $ ./hello
hello world
[email protected]:~ $ mkdir gohello
[email protected]:~ $ cp hello gohello/
[email protected]:~ $ cd gohello/
[email protected]:~/gohello $ ls
hello
[email protected]:~/gohello $ vim Dockerfile
[email protected]:~/gohello $ docker build -t myhello:latest .
Sending build context to Docker daemon 2.012MB
Step 1/3 : FROM scratch
--->
Step 2/3 : COPY hello /
---> ca4b658b1549
Step 3/3 : CMD ["/hello"]
---> Running in 2ebeeef54814
Removing intermediate container 2ebeeef54814
---> bd91ff0fe143
Successfully built bd91ff0fe143
Successfully tagged myhello:latest
[email protected]:~/gohello $ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
myhello latest bd91ff0fe143 4 seconds ago 2.01MB
ubunt[email protected]:~/gohello $ docker container run myhello
hello world