docker 部署golang web

http://blog.csdn.net/horsefoot/article/details/51654785

http://blog.csdn.net/razilfelix/article/details/70247766

使用阿里云的docker镜像加速:https://www.cnblogs.com/atuotuo/p/6264800.html

1. 编写Dockerfile

举例:

FROM golang

ADD . /go/src/beeblog
WORKDIR /go/src/beeblog

RUN go get github.com/astaxie/beego 
RUN go get github.com/Unknwon/com
RUN go get github.com/mattn/go-sqlite3
RUN go install beeblog

ENTRYPOINT /go/bin/beeblog

EXPOSE 8080

2.根据dockerfile文件构建docker 镜像

在dockerfile文件所在的目录内执行
docker build -t name .
执行完成,docker images 查看

3 . 运行docker 容器

docker run dockername

猜你喜欢

转载自blog.csdn.net/suiban7403/article/details/79401164