• docker常见问题


    docker容器中下载过慢

    1. 进入容器
      docker exec -it <容器名称/id> bash

    2. 执行命令apt-get update 发现缓慢

    3. 进入apt-get 配置目录

      cd /ect/apt
      
      • 1
    4. 执行备份命令

      cp sources.list sources.list.bak
      
      • 1
    5. 查看版本

      cat /etc/os-release
      
      • 1

      如图所示:

      PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
      NAME="Debian GNU/Linux"
      VERSION_ID="8"
      VERSION="8 (jessie)"
      ID=debian
      HOME_URL="http://www.debian.org/"
      SUPPORT_URL="http://www.debian.org/support"
      BUG_REPORT_URL="https://bugs.debian.org/"
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
    6. 选择相应版本的源,同时执行echo下的4行命令,修改成国内镜像源

      echo "">sources.list
      echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ jessie main contrib non-free">>sources.list
      echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ jessie-updates main contrib non-free">>sources.list
      echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security jessie/updates main contrib non-free">>sources.list
      ```
      
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
    7. 查看文件 是否修改成功

      cat sources.list
      
      • 1

      如图所示:

      deb http://mirrors.tuna.tsinghua.edu.cn/debian/ jessie main contrib non-free
      deb http://mirrors.tuna.tsinghua.edu.cn/debian/ jessie-updates main contrib non-free
      deb http://mirrors.tuna.tsinghua.edu.cn/debian-security jessie/updates main contrib non-free
      
      • 1
      • 2
      • 3
    8. 更新apt-get

      apt-get update
      
      • 1

      #修改完成

      apt-get install vim
      
      • 1

      #将备份完成的文件改回来,即可。

      rm sources.list
      mv sources.list.bak sources.list
      
      • 1
      • 2
    9. 小问题

      # 报错:There is no public key available for the following key IDs
      
      apt-get install debian-keyring debian-archive-keyring
      
      
      • 1
      • 2
      • 3
      • 4

    docker挂载文件无法更新

    最直接的原因就是,文件的操作权限
           我们在日常测试的过程中大多数都是管理员,所以不会关注到权限的问题,所以一直也在疑惑我明明在创建容器的时候已经挂载了文件,但是呢,在实际过程中我们修改本地文件的时候却无法实时更新到我们的容器中。
           所以万事先想想自己有没有资格做,然后再查技术思路。

    解决办法:

    # 1修改你要挂载文件的权限
    chmod 666 你的挂载文件
    # 2重新创建你的容器
    docker run xxx
    
    • 1
    • 2
    • 3
    • 4

    注意:
           要是不方便重启,就删除替换即可

    docker cp 本地文件 容器唯一标识:容器中文件路径
    
    • 1
  • 相关阅读:
    GoLang之channel数据结构及阻塞、非阻塞操作、多路select
    K8s in Action 阅读笔记——【13】Securing cluster nodes and the network
    【LeetCode热题100】--153.寻找旋转排序数组中的最小值
    SPSS一对多的数据怎么进行相关分析?
    后端连接数据库但是不能读取数据
    德人合科技|天锐绿盾加密软件——数据防泄漏系统
    容器安全工具使用指南:保障容器环境安全的利器
    防火墙firewalld
    btree学习笔记
    PaxCompiler语言的编译器
  • 原文地址:https://blog.csdn.net/Bkhole/article/details/128067591