Docker学习 - Ubuntu镜像启动使用(换阿里镜像源)

x33g5p2x  于2022-07-22 转载在 Docker  
字(1.3k)|赞(0)|评价(0)|浏览(818)

Ubuntu系统

阿里云镜像源官方配置: https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102.0.0.3e221b11PKzYs6

清华镜像源官方配置: https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

方式1 - 切换apt-阿里镜像源

/www/server/sources.list

  1. deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
  2. deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
  3. deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
  4. deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
  5. deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
  6. deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
  7. # deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
  8. # deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
  9. deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
  10. deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
  1. docker pull ubuntu
  2. # 设置apt为阿里镜像源
  3. docker run -v /www/server/sources.list:/etc/apt/sources.list --name ubuntu -it ubuntu:latest /bin/bash
  4. # 更新软件列表
  5. apt update
  6. # 安装vim编辑器
  7. apt -y install vim
  8. # 安装ifconfig命令
  9. apt -y install net-tools
方式2 - 默认apt-ubuntu镜像源
  1. docker pull ubuntu
  2. docker run --name ubuntu -it ubuntu:latest /bin/bash

相关文章

最新文章

更多