1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| apt update
apt install ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
tee /etc/apt/sources.list.d/docker.list <<EOF deb https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable EOF
apt update
apt install docker-ce docker-ce-cli containerd.io
启动 Docker 服务并设置为开机自启动: systemctl start docker systemctl enable docker
docker run hello-world
如果成功输出类似 Hello from Docker! 的信息,则表示 Docker 安装成功。
|