# 访问服务器 ssh root@47.96.159.162 # apt升级 sudo apt-get update
# 添加相关软件包 sudo apt-get install apt-transport-https sudo apt-get install ca-certificates sudo apt-get install curl sudo apt-get install software-properties-common # 下载软件包的合法性,需要添加软件源的 GPG 密钥 curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add - # source.list 中添加 Docker 软件源 sudo add-apt-repository \ "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/ \ $(lsb_release -cs) \ stable" # 安装 Docker CE (CE为社区版,可以理解为免费版,EE版为企业版,需要单独收费) sudo apt-get update sudo apt-get install docker-ce # 启动 Docker CE sudo systemctl enable docker sudo systemctl start docker # 建立 docker 用户组(附加) sudo groupadd docker sudo usermod -aG docker $USER # helloworld测试下 会自动下载 hello-world 镜像 docker run hello-world
常用镜像有以下三个
-
Azure 中国镜像 https://dockerhub.azk8s.cn
-
阿里云加速器(需登录账号获取)
-
七牛云加速器 https://reg-mirror.qiniu.com
# 添加镜像到配置文件中
vi /etc/docker/daemon.json
# 将以下代码粘贴到json文件中
{
"registry-mirrors": [
"https://dockerhub.azk8s.cn",
"https://reg-mirror.qiniu.com"
]
}
# 重新加载服务配置文件 重启docker服务
sudo systemctl daemon-reload
sudo systemctl restart docker
# 尝试下载一个nginx镜像 速度会飞快
docker pull nginx
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构