linux版离线安装docker

详细步骤:
 1.下载docker 压缩包,上传到本服务器 ,并解压 tar zxvf docker.tar.gz
 2. 进入docker目录复制所有文件到/usr/bin目录下,目的/user/bin是环境变量目录,在路径下都可以运行 
  docker命令 :     cp docker/* /usr/bin/
3. 将docker注册为service
   (1)创建文件docker.service
     命令:vim /etc/systemd/system/docker.service
     (2).将下列配置加到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.启动
    (1)添加文件权限
    chmod +x /etc/systemd/system/docker.service
 (2)重载配置文件
    docker systemctl daemon-reload
    systemctl start docker
 (3)启动
    Docker systemctl enable docker.service
    (4) 设置开机自启
5. 验证
    (1).查看Docker状态
    systemctl status docker
    (2). 查看Docker版本
    docker -v

备注:docker离线安装包和docker.service文件地址:提取码:6avv

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容