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

手动配置

#!/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 @ 2022-10-27 15:24  jingjingxyk  阅读(138)  评论(0编辑  收藏  举报