CentOS7部署阿里巴巴开源的pouch容器管理工具实战

本文涉及的产品
运维安全中心(堡垒机),企业双擎版 50资产 7天
运维安全中心(堡垒机),免费版 6个月
简介: 关于如何在CentOS 7.6操作系统上安装和使用阿里巴巴开源的Pouch容器管理工具的实战教程。

作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.安装CentOS7.6操作系统

  该过程过于简单,且CentOS 7各个版本之间部署方式几乎雷同,可参考我之前的笔记:"https://www.cnblogs.com/yinzhengjie/p/10181840.html"

  生产环境如果你要安装docker的话建议使用CentOS7.2以上版本,如果使用的版本较低可能会出现docker无法启动的情况。
AI 代码解读

二.安装pouch容器管理工具

1>.查看操作环境

[root@docker201.yinzhengjie.org.cn ~]# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core) 
[root@docker201.yinzhengjie.org.cn ~]# 
[root@docker201.yinzhengjie.org.cn ~]# uname -r
3.10.0-957.el7.x86_64
[root@docker201.yinzhengjie.org.cn ~]# 
[root@docker201.yinzhengjie.org.cn ~]# uname -m
x86_64
[root@docker201.yinzhengjie.org.cn ~]#
AI 代码解读

2>.下载阿里的软件源

[root@docker201.yinzhengjie.org.cn ~]# wget http://mirrors.aliyun.com/opsx/pouch/centos7.repo -O /etc/yum.repos.d/pouch-centos7.repo
--2020-01-13 18:39:37--  http://mirrors.aliyun.com/opsx/pouch/centos7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 27.221.92.123, 110.249.197.229, 119.167.168.229, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|27.221.92.123|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 403 [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/pouch-centos7.repo’

100%[====================================================================================================================================================================================================================================>] 403         --.-K/s   in 0s      

2020-01-13 18:39:37 (126 MB/s) - ‘/etc/yum.repos.d/pouch-centos7.repo’ saved [403/403]

[root@docker201.yinzhengjie.org.cn ~]#
AI 代码解读

[root@docker201.yinzhengjie.org.cn ~]# wget http://mirrors.aliyun.com/opsx/pouch/centos7.repo -O /etc/yum.repos.d/pouch-centos7.repo

[root@docker201.yinzhengjie.org.cn ~]# cat /etc/yum.repos.d/pouch-centos7.repo 
[pouch-stable]
name=Pouch Stable - $basearch
baseurl=http://mirrors.aliyun.com/opsx/pouch/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/opsx/pouch/linux/centos/gpg
[pouch-test]
name=Pouch Test - $basearch
baseurl=http://mirrors.aliyun.com/opsx/pouch/linux/centos/7/$basearch/test
enabled=0
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/opsx/pouch/linux/centos/gpg
[root@docker201.yinzhengjie.org.cn ~]# 
[root@docker201.yinzhengjie.org.cn ~]#
AI 代码解读

3>.通过yum的方式安装pouch

[root@docker201.yinzhengjie.org.cn ~]# yum -y install pouch
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.bit.edu.cn
 * extras: mirror.bit.edu.cn
 * updates: mirrors.aliyun.com
pouch-stable                                                                                                                                                                                                                                           | 2.9 kB  00:00:00     
pouch-stable/x86_64/primary_db                                                                                                                                                                                                                         | 8.0 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package pouch.x86_64 0:1.3.0-1.el7 will be installed
--> Processing Dependency: pam-devel for package: pouch-1.3.0-1.el7.x86_64
--> Processing Dependency: fuse-libs for package: pouch-1.3.0-1.el7.x86_64
--> Processing Dependency: fuse-devel for package: pouch-1.3.0-1.el7.x86_64
--> Processing Dependency: fuse for package: pouch-1.3.0-1.el7.x86_64
--> Running transaction check
---> Package fuse.x86_64 0:2.9.2-11.el7 will be installed
---> Package fuse-devel.x86_64 0:2.9.2-11.el7 will be installed
---> Package fuse-libs.x86_64 0:2.9.2-11.el7 will be installed
---> Package pam-devel.x86_64 0:1.1.8-22.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================================================================================================
 Package                                                          Arch                                                         Version                                                               Repository                                                          Size
==============================================================================================================================================================================================================================================================================
Installing:
 pouch                                                            x86_64                                                       1.3.0-1.el7                                                           pouch-stable                                                        44 M
Installing for dependencies:
 fuse                                                             x86_64                                                       2.9.2-11.el7                                                          base                                                                86 k
 fuse-devel                                                       x86_64                                                       2.9.2-11.el7                                                          base                                                                37 k
 fuse-libs                                                        x86_64                                                       2.9.2-11.el7                                                          base                                                                93 k
 pam-devel                                                        x86_64                                                       1.1.8-22.el7                                                          base                                                               184 k

Transaction Summary
==============================================================================================================================================================================================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 45 M
Installed size: 146 M
Downloading packages:
(1/5): fuse-2.9.2-11.el7.x86_64.rpm                                                                                                                                                                                                                    |  86 kB  00:00:00     
(2/5): fuse-devel-2.9.2-11.el7.x86_64.rpm                                                                                                                                                                                                              |  37 kB  00:00:00     
(3/5): fuse-libs-2.9.2-11.el7.x86_64.rpm                                                                                                                                                                                                               |  93 kB  00:00:00     
(4/5): pam-devel-1.1.8-22.el7.x86_64.rpm                                                                                                                                                                                                               | 184 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/pouch-stable/packages/pouch-1.3.0-1.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 439ae9ec: NOKEY===========================================================================================        ] 7.0 MB/s |  42 MB  00:00:00 ETA 
Public key for pouch-1.3.0-1.el7.x86_64.rpm is not installed
(5/5): pouch-1.3.0-1.el7.x86_64.rpm                                                                                                                                                                                                                    |  44 MB  00:00:04     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                         9.9 MB/s |  45 MB  00:00:04     
Retrieving key from http://mirrors.aliyun.com/opsx/pouch/linux/centos/gpg
Importing GPG key 0x439AE9EC:
 Userid     : "Pouch Release <pouch-dev@list.alibaba-inc.com>"
 Fingerprint: b615 ddd7 90c7 0912 582d dc2d d7ae a5ed 439a e9ec
 From       : http://mirrors.aliyun.com/opsx/pouch/linux/centos/gpg
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : fuse-libs-2.9.2-11.el7.x86_64                                                                                                                                                                                                                              1/5 
  Installing : fuse-devel-2.9.2-11.el7.x86_64                                                                                                                                                                                                                             2/5 
  Installing : fuse-2.9.2-11.el7.x86_64                                                                                                                                                                                                                                   3/5 
  Installing : pam-devel-1.1.8-22.el7.x86_64                                                                                                                                                                                                                              4/5 
  Installing : pouch-1.3.0-1.el7.x86_64                                                                                                                                                                                                                                   5/5 
  Verifying  : pam-devel-1.1.8-22.el7.x86_64                                                                                                                                                                                                                              1/5 
  Verifying  : fuse-devel-2.9.2-11.el7.x86_64                                                                                                                                                                                                                             2/5 
  Verifying  : fuse-libs-2.9.2-11.el7.x86_64                                                                                                                                                                                                                              3/5 
  Verifying  : fuse-2.9.2-11.el7.x86_64                                                                                                                                                                                                                                   4/5 
  Verifying  : pouch-1.3.0-1.el7.x86_64                                                                                                                                                                                                                                   5/5 

Installed:
  pouch.x86_64 0:1.3.0-1.el7                                                                                                                                                                                                                                                  

Dependency Installed:
  fuse.x86_64 0:2.9.2-11.el7                                     fuse-devel.x86_64 0:2.9.2-11.el7                                     fuse-libs.x86_64 0:2.9.2-11.el7                                     pam-devel.x86_64 0:1.1.8-22.el7                                    

Complete!
[root@docker201.yinzhengjie.org.cn ~]#
AI 代码解读

[root@docker201.yinzhengjie.org.cn ~]# yum -y install pouch

三.pouch工具的基本使用

1>.启动pouch

[root@docker201.yinzhengjie.org.cn ~]# systemctl status pouch
● pouch.service - pouch
   Loaded: loaded (/usr/lib/systemd/system/pouch.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[root@docker201.yinzhengjie.org.cn ~]# 
[root@docker201.yinzhengjie.org.cn ~]# systemctl start pouch
[root@docker201.yinzhengjie.org.cn ~]# 
[root@docker201.yinzhengjie.org.cn ~]# systemctl status pouch
● pouch.service - pouch
   Loaded: loaded (/usr/lib/systemd/system/pouch.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2020-01-13 18:44:21 CST; 2s ago
 Main PID: 18422 (pouchd)
    Tasks: 21
   Memory: 26.8M
   CGroup: /system.slice/pouch.service
           ├─18422 /usr/local/bin/pouchd
           └─18429 containerd --config /var/lib/pouch/containerd/state/pouch-containerd.toml --log-level info

Jan 13 18:44:19 docker201.yinzhengjie.org.cn pouchd[18422]: time="2020-01-13T18:44:19.748223865+08:00" level=info msg="loading plugin "io.containerd.grpc.v1.introspection"..." type=io.containerd.grpc.v1
Jan 13 18:44:19 docker201.yinzhengjie.org.cn pouchd[18422]: time="2020-01-13T18:44:19.748525272+08:00" level=info msg=serving... address="/run/containerd/debug.sock"
Jan 13 18:44:19 docker201.yinzhengjie.org.cn pouchd[18422]: time="2020-01-13T18:44:19.748575854+08:00" level=info msg=serving... address="/var/run/containerd.sock"
Jan 13 18:44:19 docker201.yinzhengjie.org.cn pouchd[18422]: time="2020-01-13T18:44:19.748583031+08:00" level=info msg="containerd successfully booted in 0.008565s"
Jan 13 18:44:19 docker201.yinzhengjie.org.cn pouchd[18422]: time="2020-01-13T18:44:19.753585443+08:00" level=info msg="success to start containerd" containerd-pid=18429 module=ctrd-supervisord
Jan 13 18:44:19 docker201.yinzhengjie.org.cn pouchd[18422]: time="2020-01-13T18:44:19.758489799+08:00" level=info msg="success to create 5 containerd clients, connect to: /var/run/containerd.sock"
Jan 13 18:44:19 docker201.yinzhengjie.org.cn pouchd[18422]: time="2020-01-13T18:44:19.759049076+08:00" level=info msg="Snapshotter is set to be overlayfs"
Jan 13 18:44:19 docker201.yinzhengjie.org.cn pouchd[18422]: time="2020-01-13T18:44:19.759278316+08:00" level=info msg="invoke pre-start hook in plugin"
Jan 13 18:44:21 docker201.yinzhengjie.org.cn pouchd[18422]: time="2020-01-13T18:44:21.605939977+08:00" level=info msg="start to listen to: unix:///var/run/pouchd.sock"
Jan 13 18:44:21 docker201.yinzhengjie.org.cn systemd[1]: Started pouch.
[root@docker201.yinzhengjie.org.cn ~]#
AI 代码解读

[root@docker201.yinzhengjie.org.cn ~]# systemctl start pouch

2>.查看pouch的信息

[root@docker201.yinzhengjie.org.cn ~]# pouch info              #注意观察"Default Runtime"的属性值
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
ID: 
Name: docker201.yinzhengjie.org.cn
Server Version: 1.3.0
Storage Driver: overlayfs
Driver Status: []
Logging Driver: json-file
Volume Drivers: [local tmpfs]
Cgroup Driver: cgroupfs
Default Runtime: runc
Runtimes: runc
runc: <nil>
containerd: <nil>
Security Options: [seccomp selinux]
Kernel Version: 3.10.0-957.el7.x86_64
Operating System: "CentOS Linux 7 (Core)"
OSType: linux
Architecture: amd64
HTTP Proxy: 
HTTPS Proxy: 
Registry: https://index.docker.io/v1/
Experimental: false
Debug: false
Labels:
  node_ip=192.168.6.201
  SN=VMware-56
CPUs: 2
Total Memory: 3.683GiB
Pouch Root Dir: /var/lib/pouch
LiveRestoreEnabled: true
LxcfsEnabled: false
CriEnabled: false
Daemon Listen Addresses: [unix:///var/run/pouchd.sock]
[root@docker201.yinzhengjie.org.cn ~]#
AI 代码解读

[root@docker201.yinzhengjie.org.cn ~]# pouch info              #注意观察"Default Runtime"的属性值

3>.查看pouch工具的帮助信息

[root@docker201.yinzhengjie.org.cn ~]# pouch --help
pouch is a client side tool pouch to interact with daemon side process pouchd. Flags and arguments can be input to do what actually you wish. Then pouch parses the flags and arguments and sends a RESTful request to daemon side pouchd.

Usage:
  pouch [command]

Available Commands:
  checkpoint    Manage checkpoint commands
  commit        Commit an image from a container
  create        Create a new container with specified image
  events        Get real time events from the daemon
  exec          Run a command in a running container
  gen-doc       Generate docs
  help          Help about any command
  history       Display history information on image
  image         Manage image
  images        List all images
  info          Display system-wide information
  inspect       Get the detailed information of container
  load          load a set of images from a tar archive or STDIN
  login         Login to a registry
  logout        Logout from a registry
  logs          Print a container's logs
  network       Manage pouch networks
  pause         Pause one or more running containers
  ps            List containers
  pull          Pull an image from registry
  remount-lxcfs remount lxcfs bind in containers
  rename        Rename a container with newName
  restart       restart one or more containers
  rm            Remove one or more containers
  rmi           Remove one or more images by reference
  run           Create a new container and start it
  save          Save an image to a tar archive or STDOUT
  start         Start one or more created or stopped containers
  stats         Display a live stream of container(s) resource usage statistics
  stop          Stop one or more running containers
  tag           Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  top           Display the running processes of a container
  unpause       Unpause one or more paused container
  update        Update the configurations of a container
  updatedaemon  Update the configurations of pouchd
  upgrade       Upgrade a container with new image and args
  version       Print versions about Pouch CLI and Pouchd
  volume        Manage pouch volumes
  wait          Block until one or more containers stop, then print their exit codes

Flags:
  -D, --debug              Switch client log level to DEBUG mode
  -h, --help               help for pouch
  -H, --host string        Specify connecting address of Pouch CLI (default "unix:///var/run/pouchd.sock")
      --tlscacert string   Specify CA file of TLS
      --tlscert string     Specify cert file of TLS
      --tlskey string      Specify key file of TLS
      --tlsverify          Use TLS and verify remote

Use "pouch [command] --help" for more information about a command.
[root@docker201.yinzhengjie.org.cn ~]# 
[root@docker201.yinzhengjie.org.cn ~]#
AI 代码解读

[root@docker201.yinzhengjie.org.cn ~]# pouch --help

目录
打赏
0
2
2
0
177
分享
相关文章
今日小结通过aliyun的本地容器镜像部署我的nginx和php环境
简介: 本教程介绍如何基于 Dragonwell 的 Ubuntu 镜像创建一个运行 Nginx 的 Docker 容器。首先从阿里云容器镜像服务拉取基础镜像,然后编写 Dockerfile 确保 Nginx 作为主进程运行,并暴露 80 端口。最后,在包含 Dockerfile 的目录下构建自定义镜像并启动容器,确保 Nginx 在前台运行,避免容器启动后立即退出。通过 `docker build` 和 `docker run` 命令完成整个流程。
143 24
今日小结通过aliyun的本地容器镜像部署我的nginx和php环境
容器化AI模型的持续集成与持续交付(CI/CD):自动化模型更新与部署
在前几篇文章中,我们探讨了容器化AI模型的部署、监控、弹性伸缩及安全防护。为加速模型迭代以适应新数据和业务需求,需实现容器化AI模型的持续集成与持续交付(CI/CD)。CI/CD通过自动化构建、测试和部署流程,提高模型更新速度和质量,降低部署风险,增强团队协作。使用Jenkins和Kubernetes可构建高效CI/CD流水线,自动化模型开发和部署,确保环境一致性并提升整体效率。
微软工程师偷偷在用!这款SSH工具让Windows操控CentOS比Mac还优雅!
远程登录Linux服务器是管理和维护服务器的重要手段,尤其在远程办公、云服务管理等场景中不可或缺。通过工具如XShell,用户可以方便地进行远程管理。SSH协议确保了数据传输的安全性,命令行界面提高了操作效率。配置XShell连接CentOS时,需确保Linux系统开启sshd服务和22端口,并正确设置主机地址、用户名和密码。此外,调整字体和配色方案可优化使用体验,解决中文显示问题。
126 17
微软工程师偷偷在用!这款SSH工具让Windows操控CentOS比Mac还优雅!
使用容器服务ACK快速部署QwQ-32B模型并实现推理智能路由
阿里云最新发布的QwQ-32B模型,通过强化学习大幅度提升了模型推理能力。QwQ-32B模型拥有320亿参数,其性能可以与DeepSeek-R1 671B媲美。
容器化AI模型的安全防护实战:代码示例与最佳实践
本文基于前文探讨的容器化AI模型安全威胁,通过代码示例展示如何在实际项目中实现多层次的安全防护措施。以一个基于TensorFlow的图像分类模型为例,介绍了输入验证、模型加密、API认证和日志记录的具体实现方法,并结合最佳实践,如使用安全容器镜像、限制权限、网络隔离等,帮助构建更安全的AI服务。
容器化AI模型部署实战:从训练到推理
在上一篇中,我们探讨了AI技术如何赋能容器化生态。本篇聚焦于AI模型的容器化部署,通过图像分类任务实例,详细介绍了从模型训练到推理服务的完整流程。使用PyTorch训练CNN模型,Docker打包镜像,并借助Kubernetes进行编排和部署,最终通过FastAPI提供推理服务。容器化技术极大提升了AI模型部署的便利性和管理效率,未来将成为主流趋势。
docker 是什么?docker初认识之如何部署docker-优雅草后续将会把产品发布部署至docker容器中-因此会出相关系列文章-优雅草央千澈
Docker 是一个开源的容器化平台,允许开发者将应用程序及其依赖项打包成标准化单元(容器),确保在任何支持 Docker 的操作系统上一致运行。容器共享主机内核,提供轻量级、高效的执行环境。本文介绍如何在 Ubuntu 上安装 Docker,并通过简单步骤验证安装成功。后续文章将探讨使用 Docker 部署开源项目。优雅草央千澈 源、安装 Docker 包、验证安装 - 适用场景:开发、测试、生产环境 通过以上步骤,您可以在 Ubuntu 系统上成功安装并运行 Docker,为后续的应用部署打下基础。
118 8
docker 是什么?docker初认识之如何部署docker-优雅草后续将会把产品发布部署至docker容器中-因此会出相关系列文章-优雅草央千澈
容器技术实践:在Ubuntu上使用Docker安装MySQL的步骤。
通过以上的操作,你已经步入了Docker和MySQL的世界,享受了容器技术给你带来的便利。这个旅程中你可能会遇到各种挑战,但是只要你沿着我们划定的路线行进,你就一定可以达到目的地。这就是Ubuntu、Docker和MySQL的灵魂所在,它们为你开辟了一条通往新探索的道路,带你亲身感受到了技术的力量。欢迎在Ubuntu的广阔大海中探索,用Docker技术引领你的航行,随时准备感受新技术带来的震撼和乐趣。
64 16
zabbix7.0.9安装-以宝塔安装形式-非docker容器安装方法-系统采用AlmaLinux9系统-最佳匹配操作系统提供稳定运行环境-安装教程完整版本-优雅草卓伊凡
zabbix7.0.9安装-以宝塔安装形式-非docker容器安装方法-系统采用AlmaLinux9系统-最佳匹配操作系统提供稳定运行环境-安装教程完整版本-优雅草卓伊凡
120 30
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等