1. 安装docker
离线安装路径: https://download.docker.com/linux/static/stable/x86_64/ 下载:docker-18.06.3-ce.tgz 使用ftp上传文件到服务器 解压文件: tar -zxvf docker-18.06.3-ce.tgz 复制docker文件:cp docker/* /usr/bin/ 创建docker.service文件: cd /etc/systemd/system/ touch docker.service 修改docker.service文件: vim docker.service 给docker.service文件添加执行权限:chmod 777 /etc/systemd/system/docker.service 重新加载配置文件:systemctl daemon-reload 【每次有修改docker.service文件时都要重新加载下】 启动docker: systemctl start docker 设置开机启动:systemctl enable docker.service 查看docker状态:systemctl status docker
docker.servcie文件
[Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com After=network-online.target firewalld.service Wants=network-online.target [Service] Type=notify # the default is not to use systemd for cgroups because the delegate issues still # exists and systemd currently does not support the cgroup feature set required # for containers run by docker ExecStart=/usr/bin/dockerd --graph=/home/app/docker/dockerdata/lib/docker --selinux-enabled=false --insecure-registry=10.106.210.40 ExecReload=/bin/kill -s HUP $MAINPID # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity # Uncomment TasksMax if your systemd version supports it. # Only systemd 226 and above support this version. #TasksMax=infinity TimeoutStartSec=0 # set delegate yes so that systemd does not reset the cgroups of docker containers Delegate=yes # kill only the docker process, not all processes in the cgroup KillMode=process # restart the docker process if it exits prematurely Restart=on-failure StartLimitBurst=3 StartLimitInterval=60s [Install] WantedBy=multi-user.target docker的数据默认路径是;/var/lib/docker 如果你的配置根目录(docker默认的安装路径)的磁盘容量不够大,那么需要进行docker.service文件的修改 需要修改ExecStart 参数 增加指定docker的数据安装目录 --graph=/app/docker/dockerdata/lib/docker
2. 离线安装Docker-Compose
路径:https://github.com/docker/compose/releases 注意:版本不能低于1.18.0 用ftp将文件上传到服务器 移动到/urs/local/bin,并命名为"docker-compose": sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose 添加可执行权限:sudo chmod +x /usr/local/bin/docker-compose 测试是否安装成功:docker-compose -v 出现版本信息则成功