Ubuntu 22.04 安装 Docker

一、允许apt通过HTTPS使用仓库

[root@localhost ~]# apt-get install apt-transport-https ca-certificates curl software-properties-common

二、添加Docker的官方GPG密钥

[root@localhost ~]# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

三、设置仓库

[root@localhost ~]# add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

四、更新包索引

[root@localhost ~]# apt-get update

五、安装

[root@localhost ~]# apt-get install docker-ce

六、启动并设置开机启动

[root@localhost ~]# systemctl start docker

[root@localhost ~]# systemctl enable docker