章工运维 章工运维
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)

章工运维

业精于勤,荒于嬉
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)
  • linux

  • windows

  • 中间件

  • 网络

  • 安全

  • 存储

  • 防火墙

  • 数据库

  • 系统

  • docker

    • Docker构建镜像
    • docker和docker-compose安装
      • docker和docker-compose二进制安装
      • yum安装社区版
        • Fedora/CentOS/RHEL
        • debian12
    • 如何选择docker基础镜像
    • 常见的dockerfile汇总
    • 基于官方php7.2.34镜像构建生产可用镜像
    • docker配置网络代理拉取镜像
    • dockerfile文件展示
    • buildx构建支持多CPU架构平台的docker镜像
    • Docker主机跨主机互联方式
    • 如何清除Docker缓存并释放系统空间
  • other

  • 监控

  • 运维
  • docker
章工运维
2022-12-15
目录

docker和docker-compose安装

# docker和docker-compose二进制安装

docker-compose下载地址

https://github.com/docker/compose/releases/download/1.27.4/docker-compose-Linux-x86_64

docker下载地址

Index of linux/static/stable/x86_64/ (opens new window)docker-compose下载地址

https://github.com/docker/compose/releases/download/1.27.4/docker-compose-Linux-x86_64

docker下载地址

Index of linux/static/stable/x86_64/ (opens new window)

docker.service启动服务文件

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service containerd.service
Wants=network-online.target

[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
StartLimitBurst=3
StartLimitInterval=60s
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
Delegate=yes
KillMode=process

[Install]
WantedBy=multi-user.target
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

# yum安装社区版

# Fedora/CentOS/RHEL

以下内容根据 官方文档 (opens new window) 修改而来。

如果你之前安装过 docker,请先删掉

sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine

安装一些依赖

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

根据你的发行版下载repo文件:

yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

最后安装:

sudo yum makecache

sudo yum install docker-ce

# debian12

配置清华源

cat > /etc/apt/sources.list << EOF
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
EOF
1
2
3
4
5
6
7
8
9
10
11
12
13

执行更新源

apt update
1

清华源docker地址:

https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/
1

安装docker之前需要添加 GPG 公钥,主要是用来验证安装文件是否被篡改,先安装工具:curl和gnupg2,两个工具。

apt install curl gnupg2
1

下面是清华源GPG地址,下载和添加。

curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/gpg |apt-key add -
1

配置清华源

vi /etc/apt/sources.list
1

在尾部添加清华源,bookworm代表debian12。stable代表发布分支,主要有三个:stable(稳定版)、testing(测试版)和 unstable(不稳定版)。

deb https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian bookworm stable
1

更新库,然后安装

apt update
apt install docker-ce
1
2
微信 支付宝
上次更新: 2025/04/26, 19:40:37

← Docker构建镜像 如何选择docker基础镜像→

最近更新
01
shell脚本模块集合
05-13
02
生活小技巧(认知版)
04-29
03
生活小技巧(防骗版)
04-29
更多文章>
Theme by Vdoing | Copyright © 2019-2025 | 点击查看十年之约 | 鄂ICP备2024072800号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式