当前位置: 首页 > article >正文

BC-Linux8.6上面离线手动安装Docker引擎

目标

在BC-Linux上面手动安装Docker引擎。

步骤

查看防火墙状态

[root@localhost x86_64]# sudo systemctl status firewalld.service 
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2018-06-23 11:47:32 CST; 37s ago
     Docs: man:firewalld(1)
 Main PID: 34278 (firewalld)
    Tasks: 2 (limit: 203405)
   Memory: 26.0M
   CGroup: /system.slice/firewalld.service
           └─34278 /usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopid

Jun 23 11:47:32 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Jun 23 11:47:32 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
[root@localhost x86_64]# sudo firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp1s0
  sources: 
  services: cockpit dhcpv6-client ssh
  ports: 
  protocols: 
  forward: no
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules:

卸载已有docker

sudo dnf remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine \
                  podman \
                  runc

检查服务器cpu架构

[root@localhost ~]# arch
x86_64

检查Linux发行版

[root@localhost ~]# cat /etc/*release
BigCloud Enterprise Linux release 8.6 (Core) 
BigCloud Enterprise Linux release 8.6 (Core) 
NAME="BigCloud Enterprise Linux"
VERSION="8.6 (Core)"
ID="bclinux"
ID_LIKE="rhel fedora"
VERSION_ID="8.6"
PLATFORM_ID="platform:an8"
PRETTY_NAME="BigCloud Enterprise Linux 8.6 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:bclinux:bclinux:8"
HOME_URL="https://mirrors.bclinux.org/"
BUG_REPORT_URL="https://bugs.bclinux.org/"

BCLINUX_BUGZILLA_PRODUCT="BigCloud Enterprise Linux 8 (Core)"
BCLINUX_BUGZILLA_PRODUCT_VERSION=8.6
BCLINUX_SUPPORT_PRODUCT="BigCloud Enterprise Linux 8 (Core)"
BCLINUX_SUPPORT_PRODUCT_VERSION=8.6

BigCloud Enterprise Linux release 8.6 (Core)

下载docker引擎安装包

https://download.docker.com/linux/rhel/在这个地址,选择适合的docker离线安装包。
再结合上面的信息,我们直接选择使用如下链接中的安装包:
https://download.docker.com/linux/rhel/8/x86_64/stable/Packages/
下载的离线包如下:

  • containerd.io-1.7.23-3.1.el8.x86_64.rpm
  • docker-buildx-plugin-0.17.1-1.el8.x86_64.rpm
  • docker-ce-27.3.1-1.el8.x86_64.rpm
  • docker-ce-cli-27.3.1-1.el8.x86_64.rpm
  • docker-ce-rootless-extras-27.3.1-1.el8.x86_64.rpm
  • docker-compose-plugin-2.29.7-1.el8.x86_64.rpm
    然后上传上述文件。

安装离线docker包

sudo dnf install ./containerd.io-1.7.23-3.1.el8.x86_64.rpm ./docker-ce-27.3.1-1.el8.x86_64.rpm ./docker-ce-cli-27.3.1-1.el8.x86_64.rpm ./docker-buildx-plugin-0.17.1-1.el8.x86_64.rpm ./docker-compose-plugin-2.29.7-1.el8.x86_64.rpm ./docker-ce-rootless-extras-27.3.1-1.el8.x86_64.rpm

尝试启动

尝试启动docker和设置开机自启动,如下命令:

# 设置自启动
sudo systemctl enable --now docker
sudo systemctl enable containerd

测试

sudo docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

到这里没有报错,就说明docker安装成功。
本来,到这里docker的安装,就应该结束了的,但是,我们现在这个docker需要使用非root账号进行运行。接下来在进一步,设置一下非root用户运行docker配置。

配置非root用户运行Docker

# 新建docker用户,并添加到docker用户组
sudo useradd -m -s /bin/bash docker -g docker
# 重新激活用户组设置
newgrp docker
# 设置docker用户密码
sudo passwd docker
# 设置完密码后远程登录docker用户即可
ssh docker@192.168.1.10
# 登录成功后,再次测试docker运行情况:
[docker@localhost ~]$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

到这里docker非root用户管理docker配置就设置完成了。由于给的机器磁盘有限,我们需要再进一步,设置docker滚动日志。

配置Docker滚动日志

# 新建文件
sudo vim /etc/docker/daemon.json

内容如下:

{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "700m",
    "max-file": "3"
  }
}

保持该文件后,重启docker:

sudo systemctl restart docker

到这里,手动安装docker就告一个段落了。

参考

  • Docker Engine version 27 release notes
  • Linux 查看CPU架构及内核版本
  • Index of linux/rhel/8/x86_64/stable/Packages/
  • Install Docker Engine on RHEL
  • Pull docker image for different architecture
  • hello-world
  • Linux post-installation steps for Docker Engine
  • 第十三章、帳號與身份管理 - for Mandrake 9
  • JSON File logging driver

http://www.kler.cn/a/412157.html

相关文章:

  • pytest 通过实例讲清单元测试、集成测试、测试覆盖率
  • 基于Springboot的心灵治愈交流平台系统的设计与实现
  • js:基础
  • EXTI配置流程 含中断延时消抖点亮小灯
  • Java ArrayList 与顺序表:在编程海洋中把握数据结构的关键之锚
  • 【Linux】TCP网络编程
  • 使用docker搭建hysteria2服务端
  • 类文件结构详解.下
  • Qt | 开发技能提升档次哈
  • GoogleTest做单元测试
  • [小白系列]Ubuntu安装教程-安装NodeJS
  • k8s认证、授权
  • C#基础56-60
  • unity使用笔记
  • Python 数据结构对比:列表与数组的选择指南
  • 研0找实习【学nlp】15---我的后续,总结(暂时性完结)
  • 11.26 深度学习-激活函数
  • MFC图形函数学习11——路径层函数
  • springcloud中bootstrap.yml配置文件
  • 北京航空航天大学多模态自适应攀岩机器人:突破复杂地形挑战
  • 【C++ 算法进阶】算法提升二十三
  • maven <scope>import</scope>配置作用
  • Flink学习连载文章4-flink中的各种转换操作
  • CSDN 博客自动发布脚本(Python 含自动登录、定时发布)
  • 【Android+多线程】异步 多线程 知识总结:基础概念 / 多种方式 / 实现方法 / 源码分析
  • 大模型的token是什么;常见大模型的token是多少