In the docker container manually deploy go locale

1.docker environment configuration

Get a template file of ubuntu

https://download.openvz.org/template/precreated/

Create a mirror according to a template file

cat ubuntu-16.04-x86_64.tar.gz | docker import - ubuntu-nimi

The start mirroring, create a container

docker run -itd --name go-test ubuntu-nimi

Into the container

docker exec -it go-test /bin/bash

2.go deployment environment

Configuring domestic source

vim /etc/apt/sources.list

文件内容如下
deb http://mirrors.aliyun.com/ubuntu/ great main restricted
deb http://mirrors.aliyun.com/ubuntu/ great-updates main restricted
deb http://mirrors.aliyun.com/ubuntu/ great universe
deb http://mirrors.aliyun.com/ubuntu/ great-updates universe
deb http://mirrors.aliyun.com/ubuntu/ great multiverse
deb http://mirrors.aliyun.com/ubuntu/ great-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ great-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ great-security main restricted
deb http://mirrors.aliyun.com/ ubuntu / cool-security universe
deb http://mirrors.aliyun.com/ubuntu/ great-security multiverse

If the environment can not be due to network reasons the software update source can use the following

sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list

Update software source, the basic software installation

apt-get update

apt-get install gcc libc6-dev git vim lrzsz -y

Language software installation go

apt-get install golang -y

The basic configuration of environment variables go

export GOROOT=/usr/local/go
export PATH=$PATH:/usr/local/go/bin
export GOPATH=/root/go
export PATH=$GOPATH/bin/:$PATH

3.go project deployment

 

Guess you like

Origin www.cnblogs.com/songyanxin/p/11333079.html