搜索看看
ubuntu 20 apt安装Docker
1、先卸载旧版,如果没有的话,就不用执行了,跳过往下看,直接第二步
root@vultr:/# apt-get remove docker docker-engine docker.io containerd runc
2、在终端输入
root@vultr:/# apt update Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB] ...... ...... root@vultr:/# apt-get install ca-certificates curl gnupg lsb-release Reading package lists... Done Building dependency tree Reading state information... Done ...... ......
3、安装证书
root@vultr:/# curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - OK
4、写入软件源信息
root@vultr:/# sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" Hit:1 http://ubuntu.mirror.constant.com focal InRelease Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease ......
5、开始安装Docker
root@vultr:/# sudo apt-get install docker-ce docker-ce-cli containerd.io Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: docker-buildx-plugin docker-ce-rootless-extras docker-compose-plugin pigz slirp4netns Suggested packages: aufs-tools cgroupfs-mount | cgroup-lite The following NEW packages will be installed: containerd.io docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin pigz slirp4netns 0 upgraded, 8 newly installed, 0 to remove and 24 not upgraded. Need to get 121 MB of archives. After this operation, 434 MB of additional disk space will be used. Do you want to continue? [Y/n] y ......
中途出现问题的话,使用 sudo apt-get update 试试
6、启动docker服务
root@vultr:/# systemctl start docker
7、重启docker服务
root@vultr:/# service docker restart
8、查看docker版本信息
root@vultr:/# sudo docker version
9、查看docker镜像
root@vultr:/# sudo docker images
到此就安装完成了