Última atividade 1727188041

zhangyw revisou este gist 1727188040. Ir para a revisão

1 file changed, 28 insertions

ubuntu-install-docker.sh(arquivo criado)

@@ -0,0 +1,28 @@
1 + #!/bin/bash
2 +
3 + # 更新现有的包列表
4 + sudo apt update
5 +
6 + # 安装依赖包
7 + sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
8 +
9 + # 添加 Docker 的官方 GPG 密钥
10 + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
11 +
12 + # 设置 Docker 仓库
13 + sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
14 +
15 + # 更新包列表
16 + sudo apt update
17 +
18 + # 安装 Docker
19 + sudo apt install -y docker-ce
20 +
21 + # 启动 Docker 并设置为开机自启
22 + sudo systemctl start docker
23 + sudo systemctl enable docker
24 +
25 + # 验证 Docker 安装
26 + sudo docker run hello-world
27 +
28 + echo "Docker 已成功安装并运行!"
Próximo Anterior