Ubuntu16.04 Server版安装及docker安装

安装Ubuntu16.04 Server版本

参考:https://www.cnblogs.com/gu-bin/p/11333480.html

优化Apt源

$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
$ echo 'deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse' | sudo tee /etc/apt/sources.list

安装Docker-ce:使用官方脚本

$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh --mirror Aliyun

启动 Docker-ce

$ sudo systemctl enable docker
$ sudo systemctl start docker

优化Docker源

$ sudo touch /etc/docker/daemon.json
$ echo '{
"registry-mirrors": [
"https://dockerhub.azk8s.cn",
"https://hub-mirror.c.163.com"
]
}'| sudo tee /etc/docker/daemon.json
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker

使Docker可以限制容器内存使用上限

$ sudo sed -i s/'GRUB_CMDLINE_LINUX=""/'GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1'"/g /etc/default/grub
$ sudo update-grub
$ sudo reboot

猜你喜欢

转载自blog.51cto.com/dldxzjr/2517922