注意docker最好安装在centeros7中,如果安装在centeros6.5则需要升级内核版本!非常麻烦,就算升级了在安装docker时也会出现依赖版本过低问题,如
container-selinux >= 2.9
要解决这些问题就需要到指定的镜像网站下载安装。所以不如直接使用centeros7
版本关系
root@localhost redis]# docker -v Docker version 18.06.1-ce, build e68fc7a
[root@localhost ~]# docker-compose -v docker-compose version 1.18.0, build 8dd22a9
Docker
sudo yum install -y yum-utils \ device-mapper-persistent-data \ lvm2
sudo yum-config-manager \ --add-repo \ http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum list docker-ce --showduplicatesimage.png
sudo yum install docker-ce-18.06.1.ce
[root@localhost docker]# docker -v Docker version 18.06.1-ce, build e68fc7a
vim /lib/systemd/system/docker.service
找到ExecStart行,修改成下边这样
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
用浏览器访问查看是否成功
http://192.168.10.104/version,我ip是这个。如果是别的ip换下即可
image.png远程访问成功~
vim /etc/docker/daemon.json
{ "registry-mirrors": ["http://hub-mirror.c.163.com"] }
然后重启守护进程:
sudo systemctl daemon-reload
sudo systemctl restart docker
docker-compose
curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
sudo rm /usr/local/bin/docker-compose
harbors安装
下载安装包
tar -xvf harbor-offline-installer-v1.9.0.tgzimage.png
hostname 这里设置本机的ip
harbor_admin_password 登录密码
port 端口号
sh ./install.shimage.png