安装Docker
Docker安装 国内一键安装 sudo curl -sSL https://get.daocloud.io/docker | sh
国外一键安装 sudo curl -sSL get.docker.com | sh
一堆报错
这是我们本地yum源的问题,使用下面阿里云的源就ok了
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
yum -y install docker-ce
启动docker
[root@jd-docker2 jd]# systemctl start docker
[root@jd-docker2 jd]# systemctl enable docker
docker-compose国内安装
curl -L https://get.daocloud.io/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose up -d 启动(修改docker-compose.yml后需要使用此命令使更改生效);
docker-compose logs 打印日志;
docker-compose pull 更新镜像;
docker-compose stop 停止容器;
docker-compose restart 重启容器;
docker-compose down 停止并删除容器;
部署portainer
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock –restart=always –name prtainer portainer/portainer
访问9000端口
开通防火墙
firewall-cmd –permanent –zone=public –add-port=9000/tcp
firewall-cmd –reload
本机ip:9000