Anolis 安装 Docker
预备
Alionos (Linux操作系统)
Docker (Docker容器)
物理机
操作
- 安装 Docker 环境
dnf -y install yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
dnf -y install docker-ce docker-ce-cli
systemctl start docker - 变更 Docker 目录
systemctl stop docker docker.socket
mv /var/lib/docker /data/docker
ln -s /data/docker /var/lib/docker
systemctl start docker - 设置 Docker 随机启动
systemctl enable docker - 安装Docker-compose 脚本
dnf install wget -y
wget https://github.com/docker/compose/releases/download/1.26.2/docker-compose-uname -s
-uname -m
chmod +x docker-compose-Linux-x86_64
mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose - 打包物理机
tar -cvpf /tmp/backup.tar --directory=/ --exclude=proc --exclude=sys --exclude=dev --exclude=run --exclude=boot --exclude=tmp / - 传输到宿主服务器
sshpass -p 密码 rsync -avz --progress -e ‘ssh -p 端口’ /tmp/backup.tar 用户@IP:远程目录 - 导入镜像
cat backup.tar | docker import - fyimagecentos:1.0 bash - 更新时区
rpm -ivh http://mirrors.wlnmp.com/centos/wlnmp-release-centos.noarch.rpm
yum install wntp
ntpdate ntp1.aliyun.com - 运行镜像
docker run -itd --privileged -v /etc/localtime:/etc/localtime:ro --name fy_image_deploy -p 80:80 -p 443:443 -p 53:53/udp fyimagecentos:1.0 /bin/bash
docker exec -it fy_image_deploy /bin/bash
mkdir /tmp
chmod +777 /tmp
mkdir /var/run - 重启窗口
docker restart fy_image_deploy