1. 动机
docker公开的ubuntu镜像大多数都是使用ubuntu官方的镜像源,容易下载失败或者网速过慢
2. 替换
比如,如下的Dockerfile
1 FROM nvidia/opengl:base-ubuntu18.04 2 3 ARG DEBIAN_FRONTEND=noninteractive 4 5 RUN apt -y update && / 6 cp /etc/apt/sources.list /etc/apt/sources.list.ori && / 7 sed -i s@/archive.ubuntu.com/@/mirrors.ustc.edu.cn/@g /etc/apt/sources.list && / 8 sed -i s@/security.ubuntu.com/@/mirrors.ustc.edu.cn/@g /etc/apt/sources.list && / 9 apt clean && apt -y update && apt -y install / 10 freeglut3-dev clang-format build-essential cmake / 11 xorg-dev libglu1-mesa-dev 12 13 # Clean up APT when done. 14 RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
通过第7、8两行,将软件源更换为ustc。
运行测试:sudo docker build -t opengl-tutorial .
原创文章,作者:,如若转载,请注明出处:https://blog.ytso.com/276835.html