1.ssh root@ip服务器(ssh得打开,弄完想着关闭)
2.ssh-keygen -R ip(得看1报错用这个:Host key verification failed.)
3.ssh root@ip服务器
4.centos 安装docker
官方参考地址:Redirecting…
里面包含包下载地址: Index of linux/centos/7/x86_64/stable/Packages/
安装依赖
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
如果报错:Problem: package docker-ce-3:19.03.4-3.el7.x86_64 requires containerd.io >= 1.2.2-3 那就先装新版的 containerd.io
dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
再装剩下两个
sudo yum install docker-ce docker-ce-cli
sudo systemctl start docker
docker --version
开机自启
sudo systemctl enable docker
5.docker pull nginx
6.查看 docker ps -a
7下载软件filezilla 文件进行
8.在远程服务器home文件下创建project 前端代码dist放入这里
9.docker run --name some-nginx -d -p 8908:80 -v /home/project/dist:/usr/share/nginx/html:ro -d nginx ( 别忘了安全组开启8908和80 端口号)