docker export $(docker create golang:1.10.1) | tar -C rootfs -xvf - $ runc spec $ vim config.json // add PATH /go/bin:/usr/local/go/bin $ sudo runc run mygolangcontainer # which go /usr/local/go/bin/go # go Go is a tool for managing Go source code. ... Run container without docker Note: tested on arch linux
hello-docker REPOSITORY TAG IMAGE ID CREATED SIZE hello-docker v2 6b84ba9a4a72 About an hour ago 382MB hello-docker v1 77867ff7da90 About an hour ago 787MB
ID CREATED SIZE hello-docker v2 6b84ba9a4a72 About an hour ago 382MB golang 1.10.1-alpine 52d894fca6d4 2 days ago 376MB hello-docker v1 77867ff7da90 About an hour ago 787MB golang 1.10.1 6fe15d4cbc64 2 weeks ago 780MB 6MB 7MB
/go/src/github.com/sakajunquality/hello-go-docker COPY main.go main.go RUN go get -d -v ./... RUN go install -v ./... FROM alpine RUN apk add --no-cache ca-certificates COPY --from=build /go/bin/hello-go-docker /usr/local/bin/hello-go-docker CMD ["hello-go-docker"]
grep hello-docker REPOSITORY TAG IMAGE ID CREATED SIZE hello-docker v3 a5048da4d653 23 minutes ago 11.3MB hello-docker v2 6b84ba9a4a72 About an hour ago 382MB hello-docker v1 77867ff7da90 About an hour ago 787MB
… RUN go install … FROM node:9 as static-build … RUN yarn install … FROM alpine … COPY --from=build /go/bin/myapp /usr/local/bin/myapp COPY --from=build-static /path/to/myapp/static /usr/local/src/myapp/static CMD ["myapp"]