https://download.openvz.org/template/precreated/
cat ubuntu-16.04-x86_64.tar.gz | docker import - ubuntu-nimi
docker run -itd --name go-test ubuntu-nimi
docker exec -it go-test /bin/bash
vim /etc/apt/sources.list
文件内容如下
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
如果由于网络环境原因不能进行软件源更新可以使用如下内容
sudo sed -i ‘s/archive.ubuntu.com/mirrors.ustc.edu.cn/g‘ /etc/apt/sources.list
apt-get update
apt-get install gcc libc6-dev git vim lrzsz -y
apt-get install golang -y
export GOROOT=/usr/local/go
export PATH=$PATH:/usr/local/go/bin
export GOPATH=/root/go
export PATH=$GOPATH/bin/:$PATH
原文:https://www.cnblogs.com/songyanxin/p/11333079.html