通过 uname -r 命令查看你当前的内核版本
uname
-r
yum update
卸载旧版本docker
yum
-y remove docker docker
-common docker
-selinux docker
-engine
设置yum源
yum
-config
-manager
--add
-repo https
://download
.docker
.com
/linux
/centos
/docker
-ce
.repo
yum
-config
-manager
--add
-repo http
://mirrors
.aliyun
.com
/docker
-ce
/linux
/centos
/docker
-ce
.repo #阿里云yum源
查看所有仓库中所有docker版本,并选择特定版本安装
yum list docker
-ce
--showduplicates
| sort
-r
安装docker
yum install
-y docker
-ce #由于repo中默认只开启stable仓库,故这里安装的是最新稳定版
17.12.0
yum install
-y
<FQPN
> # 例如:sudo yum install docker
-ce
-17.12.0.ce
启动docker并加入开机自动启动
systemctl start docker
systemctl enable docker
配置阿里云镜像加速
mkdir
-p
/etc
/docker
vi
/etc
/docker
/daemon
.json
添加以下内容
{"registry-mirrors":
["https://5f2jam6c.mirror.aliyuncs.com",
"http://hub-mirror.c.163.com"]
}
重新加载配置文件
systemctl reload docker
重启docker
systemctl restart docker
下载镜像
docker pull sonatype
/nexus3
创建数据目录
mkdir
-vp
/opt
/nexus
/nexus
-data
&& chown
-R
200 /opt
/nexus
/nexus
-data
启动容器
docker run
-d
-p
8081:8081 --name nexus
--restart
=always
-v
/opt
/nexus
/nexus
-data
:/nexus
-data sonatype
/nexus3
访问
http
://ip
:8081
ip 为远程主机的 ip 地址
默认用户名
/密码
: admin
/admin123,如果登不上去只能去docker容器中查看密码了,然后登录后修改密码即可
如果安装出现错误,请评论。