官方方式安装-Install Docker Engine
脚本自动安装
- Docker 提供了一个自动配置与安装的脚本,支持 Debian、RHEL、SUSE 系列及衍生系统的安装。
- 前置条件: 您为 root 用户,或有 sudo 权限,或知道 root 密码;您系统上有 curl 或 wget
1
2
3
4
5
| export DOWNLOAD_URL="https://mirrors.tuna.tsinghua.edu.cn/docker-ce"
# 如您使用 curl
curl -fsSL https://get.docker.com/ | sudo -E sh
# 如您使用 wget
wget -O- https://get.docker.com/ | sudo -E sh
|
配置国内镜像源
- 第一步:新建或编辑daemon.json :
vi /etc/docker/daemon.json - 第二步:daemon.json中编辑如下
1
2
3
4
5
6
7
8
9
| {
"registry-mirrors": [
"https://registry.hub.docker.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn",
"https://registry.docker-cn.com",
"https://registry.hub.docker.com"
]
}
|
1
2
3
4
5
| 1.Docker中国区官方镜像
https://registry.docker-cn.com
2.网易
http://hub-mirror.c.163.com
|
安装portainer
1
2
| #启动Portainer
docker run -dit -p 9000:9000 -v /root/portainer:/data -v /var/run/docker.sock:/var/run/docker.sock --name portainer portainer/portainer:latest
|
安全问题
Docker启用TLS加密解决暴露2375端口引发的安全漏洞