Ubuntu 18.04安装 docker 环境

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Snrt_Julier/article/details/83990288

ubuntu 18.04 环境安装

## docker 安装
apt-get remove docker docker-engine docker.io
## Ubuntu 14.04 可选内核模块
# apt-get update
# apt-get install linux-image-extra-$(uname -r)  linux-image-extra-virtual
#
## 16.04.+
sudo apt-get install  apt-transport-https ca-certificates  curl  software-properties-common

# 镜像源
# $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository  "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# 16.04
#deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu xenial stable
# 18.04
# deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic stable


# 官方源
# $ sudo add-apt-repository  "deb [arch=amd64] https://download.docker.com/linux/ubuntu  $(lsb_release -cs) stable"

apt-get update && apt-get install docker-ce

# 将用户添加进docker 使普通用户也可以使用docker命令
# docker 组存在也无所谓
sudo groupadd docker
# 添加用户
sudo gpasswd -a ${USER} docker
# 这一步需要在root下
sudo chmod a+rw /var/run/docker.sock

# 启动 Docker CE
systemctl enable docker
systemctl start docker
## 14.04
# service docker start

# 镜像设置
mkdir -p /etc/docker && sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://yfexy6ee.mirror.aliyuncs.com"]
}
EOF
# 重启
systemctl daemon-reload  && systemctl restart docker

多余

## golang 环境的安装 1.7及以上
apt-get install golang
# 没有测试成功
# wget -c https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz
# tar xf go1.7.3.linux-amd64.tar.gz
#

## flannel 安装
# sudo yum install linux-libc-dev gcc
git clone https://github.com/coreos/flannel
cd flannel
make dist/flanneld-amd64

## 安装 etcd
# git clone https://github.com/etcd-io/etcd.git
# cd etcd
# echo $GOPATH
# go get -v go.etcd.io/etcd
# ./build
curl -L https://github.com/etcd-io/etcd/releases/download/v3.3.10/etcd-v3.3.10-linux-amd64.tar.gz
tar xf etcd-v3.0.15-linux-amd64.tar.gz

猜你喜欢

转载自blog.csdn.net/Snrt_Julier/article/details/83990288