• ubuntu离线安装docker导入镜像


    docker安装包

    准备工作

    1.准备一个docker.service文件

    内容如下:

    1. [Unit]
    2. Description=Docker Application Container Engine
    3. Documentation=https://docs.docker.com
    4. After=network-online.target firewalld.service
    5. Wants=network-online.target
    6. [Service]
    7. Type=notify
    8. # the default is not to use systemd for cgroups because the delegate issues still
    9. # exists and systemd currently does not support the cgroup feature set required
    10. # for containers run by docker
    11. ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock --selinux-enabled=false --default-ulimit nofile=65536:65536
    12. ExecReload=/bin/kill -s HUP $MAINPID
    13. # Having non-zero Limit*s causes performance problems due to accounting overhead
    14. # in the kernel. We recommend using cgroups to do container-local accounting.
    15. LimitNOFILE=infinity
    16. LimitNPROC=infinity
    17. LimitCORE=infinity
    18. # Uncomment TasksMax if your systemd version supports it.
    19. # Only systemd 226 and above support this version.
    20. #TasksMax=infinity
    21. TimeoutStartSec=0
    22. # set delegate yes so that systemd does not reset the cgroups of docker containers
    23. Delegate=yes
    24. # kill only the docker process, not all processes in the cgroup
    25. KillMode=process
    26. # restart the docker process if it exits prematurely
    27. Restart=on-failure
    28. StartLimitBurst=3
    29. StartLimitInterval=60s
    30. [Install]
    31. WantedBy=multi-user.target

    假定安装包和docker.service文件以及各种镜像包都在/home/carrot/docker中

    正片开始

    进入位置

    cd /home/carrot/docker

    解压

    tar -zxvf docker-24.0.7.tgz

    复制

    1. sudo cp docker/* /usr/bin
    2. sudo cp docker.service /etc/systemd/system/

    赋予权限

    sudo chmod +x /etc/systemd/system/docker.service

    开启docker并并设置开机自启动

    1. sudo systemctl daemon-reload
    2. sudo systemctl start docker
    3. sudo systemctl enable docker.service

    收尾

    将准备好的镜像包导入(以ubuntu镜像包为例)注意xxx.tar 是通过其他服务器执行docker save获取的

    sudo  docker load -i xxx.tar

    使用docker权限不足时

    1. # 添加docker用户组,一般已存在,不需要执行
    2. sudo groupadd docker
    3. # 将登陆用户加入到docker用户组中
    4. sudo gpasswd -a $USER docker
    5. # 更新用户组
    6. newgrp docker
    7. # 以上操作不行就重启 (慎用)
    8. sudo reboot

    镜像导入完成后删除多余文件

    1. cd ..
    2. rm -r docker

  • 相关阅读:
    基于SpringBoot设计模式之结构型设计模式·适配器模式
    FPGA学习笔记(七)verilog的深入学习之任务与函数(语法篇3)
    03142《互联⽹及其应⽤》各章简答题解答(课后习题)
    同一个页面同一区域两个el-table在v-if下样式重叠问题
    M1通讯层的校验-尾块
    uniapp使用抖音微信自定义组件
    Oracle/PLSQL: From_Tz function
    centerOS搭建kafka集群
    27_Scala功能函数
    65_Pandas显示设置(小数位数、有效数字、最大行/列数等)
  • 原文地址:https://blog.csdn.net/JY123456abc/article/details/139927703