linux 快速安装docker
文档说明:只记录关键地方;
试验环境: linux debian 11
目标:debian或者ubuntu 快速使用上docker
一条命令安装
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
# 使用阿里云镜像源
# sh get-docker.sh --mirror Aliyun
# 直接使用github 仓库源码
curl -fsSL https://github.com/docker/docker-install/blob/master/install.sh?raw=true | bash -s -- --mirror Aliyun
手动配置
#!/bin/bash
# https://www.ruanyifeng.com/blog/2017/11/bash-set.html
set -eux
set -o pipefail
# https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/
# https://docs.docker.com/engine/install/debian/
# https://developer.aliyun.com/mirror/docker-ce/
__DIR__=$(cd "$(dirname "$0")";pwd)
cd ${__DIR__}
apt update -y
# step 1: 安装必要的一些系统工具
apt install -y ca-certificates curl gnupg gnupg2 gnupg1 lvm2 lsb-release apt-transport-https curl sudo
mkdir -p /etc/apt/keyrings
# step 2: 安装GPG证书
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# Step 3: 写入软件源信息
test -f /etc/apt/sources.list.d/docker.list && rm -rf /etc/apt/sources.list.d/docker.list
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Step 4: 更新并安装Docker-CE
apt update -y
apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
参考文档
- debian docker
- docker-ce | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
- Docker CE 源使用帮助 — USTC Mirror Help 文档
- docker-ce镜像_docker-ce下载地址_docker-ce安装教程-阿里巴巴开源镜像站
- Docker Desktop on Mac
- Docker Desktop on Windows
- shell之变量默认值
- Dockerfile
- Compose file
- multistage-build
- dockerfile mount type 挂载目录
- dockerfiles-now-support-multiple-build-contexts
- 自建拉取registry.k8s.io、k8s.gcr.io、gcr.io、quay.io、ghcr.io 容器镜像的服务
- pdoman-desktop
- Docker+Wasm