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

参考文档

  1. debian docker
  2. docker-ce | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
  3. Docker CE 源使用帮助 — USTC Mirror Help 文档
  4. docker-ce镜像_docker-ce下载地址_docker-ce安装教程-阿里巴巴开源镜像站
  5. Docker Desktop on Mac
  6. Docker Desktop on Windows
  7. shell之变量默认值
  8. Dockerfile
  9. Compose file
  10. multistage-build
  11. dockerfile mount type 挂载目录
  12. dockerfiles-now-support-multiple-build-contexts
  13. 自建拉取registry.k8s.io、k8s.gcr.io、gcr.io、quay.io、ghcr.io 容器镜像的服务
  14. pdoman-desktop
  15. Docker+Wasm
posted @   jingjingxyk  阅读(151)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
点击右上角即可分享
微信分享提示