阿里服务器docker部署

首先本人是购买的阿里云服务器,虽然是1g的内存,不过部署一些项目还是没问题的,学生也有一个优惠服务器,好像是70多2g内存的,还是很舒服的,学生党可以试着部署一下,下面呢我就说一下我自己部署的步骤:

1.注册阿里云:网址:https://www.aliyun.com

2.注册完之后购买云服务器,服务器选择的系统我记得是centos7.7:

3.进入刚才购买的服务器控制台(阿里好多东西还是很好用的,本人常用的一些就是oss对象存储,短信服务):

4.下载一个xshell6软件,用户远端连接你的服务器:

​ 下载地址:https://xshell.en.softonic.com/,安装步骤就是下一步下一步就行

5.打开xshell6连接你的虚拟机,注意连得ip是公网ip,私网ip是连不上的


6.首先一个新的虚拟机要关闭防火墙:

systemctl status firewalld (查看防火墙状态)
systemctl stop firewalld    (停止防火墙)
systemctl disable firewalld(禁止开机启动)

7.安装wget、vim

yum –y install wget
yum –y install vim*

8.安装docker

检查内核版本,返回的值大于3.10即可。
uname -r
如果内核版本低,需要更新系统
yum update
下边这段是我从官网上截下来的
1、Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.
指令
yum install -y yum-utils 
  device-mapper-persistent-data 
  lvm2

2、Use the following command to set up the stable repository.
指令
yum-config-manager 
    --add-repo 
https://download.docker.com/linux/centos/docker-ce.repo 

9.查看docker版本

yum list docker-ce --showduplicates | sort -r

10.docker设置为开机启动

yum -y install docker-ce-18.03.1.ce-1.el7.centos
systemctl start docker(启动docker)
systemctl enable docker(设为开机启动)

11.设置docker的镜像加速,这里我用的阿里云的镜像加速,其中sudo是root用户的意思,不懂得可以补一下linux指令知识啦。

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://82m9ar63.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

下一篇开始讲解阿里云docker部署mysql和开放端口的坑,如果能帮到你希望能点个关注交个朋友。

原文地址:https://www.cnblogs.com/balloon72/p/12417013.html