ubuntu下配置docker

1、版本查看 lsb_release -a

2、docker前期准备

① ubuntu下自带了docker的库,可能不需要添加新的源。

但是ubuntu自带的docker版本太低,需要先卸载旧的再安装新的

注:docker的旧版本不一定被称为docker,docker.io 或 docker-engine也有可能,所以我们卸载的命令为:

$ apt-get remove docker docker-engine docker.io containerd runc

 

包和依赖

更新软件包

sudo apt update

sudo apt upgrade

sudo apt-get install ca-certificates curl gnupg lsb-release

添加Docker官方的GPG密钥:

curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

 添加Docker的软件源:

sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

3、安装 启动 重启 验证

    apt-get install docker-ce docker-ce-cli containerd.io

    systemctl start docker

    service docker restart

    systemctl status docker.service  (查看运行状态)

验证是否安装成功:

    sudo docker run hello-world

切换到/etc/docker路径下,创建文件daemon.json,写入

{
    "registry-mirrors": ["https://hub.atomgit.com/"],
    "live-restore": true
}

注意网上很多镜像源已经不能使用,比如

Docker国内源说明:

https://registry.docker-cn.com

http://hub-mirror.c.163.com

https://docker.mirrors.ustc.edu.cn

https://pee6w651.mirror.aliyuncs.com

自己去试

https://hub.atomgit.com/ 可以访问

成功截图

参考链接:2024年7月,解决国内无法拉取docker官方镜像问题_国内无法拉取docker镜像-CSDN博客

最详细的ubuntu 安装 docker教程-阿里云开发者社区 (aliyun.com)

docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled-CSDN博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值