1.下载docker安装文件。
地址:https://download.docker.com/linux/static/stable/x86_64/
我下载的版本是docker-18.06.3-ce.tgz
2.上传docker到服务器
以使用putty为例子。
打开putty目录下的psFTP。输入以下命令:
#输入linux的地址
open 192.168.3.237
#输入登录的用户/密码
#复制文件,前面是windows中的地址,后面是linux中的地址
put C:/Users/e490/Downloads/docker-18.06.3-ce.tgz /usr/local/docker-18.06.3-ce.tgz
#等待上传完成。
3.安装docker服务
进入linux服务器。
#进入dokcer上传的目录:/usr/lcoal
cd /usr/local
#解压到当前目录
tar -zxvf docker-18.06.3-ce.tgz
#复制到/user/bin
cp docker/* /usr/bin/
将docker注册为服务,
vim /etc/systemd/system/docker.service
内容为:
[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
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
4.启动docker
#赋予权限
chmod +x /etc/systemd/system/docker.service
#重载unit配置文件
systemctl daemon-reload
#启动Docker
systemctl start docker
#设置开机自启
systemctl enable docker.service
5.检查docker
#查看Docker状态
systemctl status docker
#查看Docker版本
docker -v
参考文章:https://www.cnblogs.com/luoSteel/p/10038954.html
6.下载docker-compose文件
地址:https://github.com/docker/compose/releases
下载这个docker-compose-Linux-x86_64
7.上传docker-compose到服务器
以使用putty的psFTP 为例子。
把文件的名字改成docker-compose,直接上传到/usr/bin
#输入linux的地址
open 192.168.3.237
#输入登录的用户/密码
#复制文件,前面是windows中的地址,后面是linux中的地址
put C:/Users/e490/Downloads/docker-compose /usr/bin/docker-compose
8.授权与测试
#授权
chmod +x docker-compose
#测试
docker-compose -v
docker与docker-compose的离线安装就完成了