1、配置镜像点
cd /etc/apt cp sources.list sources.list.bak vim sources.list
2、Ubuntu 20.04,阿里云
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
3、安装Docker
apt-get remove docker docker-engine docker.io containerd runc apt-get update curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
这一步如果出错,可以先按下面的安装依赖项
apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
4、添加 docker镜像加速
sudo vim /etc/docker/daemon.json
{ "registry-mirrors": ["https://xxxxxx.mirror.aliyuncs.com"] }
sudo systemctl daemon-reload sudo systemctl restart docker
5、安装 .net
hub地址 .NET - Docker Hub
.net 5 sdk - docker
docker pull mcr.microsoft.com/dotnet/sdk:5.0
aspnet 5 - docker
dotnet-dcoker 项目地址:GitHub - dotnet/dotnet-docker: Docker images for .NET Core and the .NET Core Tools.
docker pull mcr.microsoft.com/dotnet/aspnet:5.0
6、结果
root@xxx:/etc/apt# docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest bc9a0695f571 7 hours ago 133MB mcr.microsoft.com/dotnet/aspnet latest 0e394d284ae5 7 days ago 205MB