Loading [MathJax]/jax/output/CommonHTML/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >Ubuntu安装podman

Ubuntu安装podman

作者头像
用户6792968
发布于 2022-08-30 04:10:50
发布于 2022-08-30 04:10:50
2.4K00
代码可运行
举报
文章被收录于专栏:fred 随笔fred 随笔
运行总次数:0
代码可运行

podman是什么

Podman 是一个开源的容器运行时项目,可在大多数 Linux 平台上使用。Podman 提供与 Docker 非常相似的功能。它不需要在你的系统上运行任何守护进程,并且它也可以在没有 root 权限的情况下运行。

Podman 可以管理和运行任何符合 OCI(Open Container Initiative)规范的容器和容器镜像。Podman 提供了一个与 Docker 兼容的命令行前端来管理 Docker 镜像。

Podman和Docker的主要区别是什么?

  • docker 在实现 CRI 的时候,它需要一个守护进程,其次需要以 root 运行,因此这也带来了安全隐患。
  • podman 不需要守护程序,也不需要 root 用户运行,从逻辑架构上,比 docker 更加合理。
  • 在 docker 的运行体系中,需要多个 daemon 才能调用到 OCI 的实现 RunC。
  • 在容器管理的链路中,Docker Engine 的实现就是 dockerd daemon,它在 linux 中需要以 root 运行,dockerd 调用 containerd,containerd 调用 containerd-shim,然后才能调用 runC。顾名思义 shim 起的作用也就是“垫片”,避免父进程退出影响容器的运行。
  • podman 直接调用 OCI,runtime(runC),通过 common 作为容器进程的管理工具,但不需要 dockerd 这种以 root 身份运行的守护进程。
  • 在 podman 体系中,有个称之为 commo n的守护进程,其运行路径通常是 /usr/libexec/podman/conmon,它是各个容器进程的父进程,每个容器各有一个,common 的父则通常是1号进程。podman 中的 common 其实相当于docker体系中的 containerd-shim。podman 不需要守护进程,而 dorker 需要守护进程。

部署podman

1、podman只有Ubuntu21才支持,需要先升级系统至Ubuntu11

操作系统

服务器厂商

Ubuntu20.14

腾讯轻量服务器

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
cd /etc/apt
mv sources.list sources.list_20.14    # 备份原来的配置文件
cat << eof >> sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb http://mirrors.cloud.tencent.com/ubuntu/ impish main restricted universe multiverse
# deb-src http://mirrors.cloud.tencent.com/ubuntu/ impish main restricted universe multiverse
deb http://mirrors.cloud.tencent.com/ubuntu/ impish-updates main restricted universe multiverse
# deb-src http://mirrors.cloud.tencent.com/ubuntu/ impish-updates main restricted universe multiverse
deb http://mirrors.cloud.tencent.com/ubuntu/ impish-backports main restricted universe multiverse
# deb-src http://mirrors.cloud.tencent.com/ubuntu/ impish-backports main restricted universe multiverse
deb http://mirrors.cloud.tencent.com/ubuntu/ impish-security main restricted universe multiverse
# deb-src http://mirrors.cloud.tencent.com/ubuntu/ impish-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb http://mirrors.cloud.tencent.com/ubuntu/ impish-proposed main restricted universe multiverse
# deb-src http://mirrors.cloud.tencent.com/ubuntu/ impish-proposed main restricted universe multiverse
eof
apt update
apt upgrade -y
2、安装podman
代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
# Ubuntu安装podman
apt  install  podman -y
# centos安装podman
yum  install  -y podman
# mac下安装podman
brew install podman
# arch下安装podman
sudo pacman -S podman
3、修改默认的容器镜像源以及数据存放目录
代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
cd /etc/containers/
# centos7修改默认加速器
sed -i -e /[registries.search]/s/[/#[/g -e /registry.access.redhat.com/s/registries/#registries/g  registries.conf
cat << eof >> registries.conf
[registries.search]
registries = ["docker.io"]
[[docker.io]]
location="j3m2itm3.mirror.aliyuncs.com"
eof
# centos8以及Ubuntu修改默认加速器
sed -i /unqualified-search-registries/s/unqualified/#unqualified/g registries.conf
cat << eof >> registries.conf
unqualified-search-registries = ["docker.io"]
[[registry]]
prefix = "docker.io"
location = "j3m2itm3.mirror.aliyuncs.com" 
eof

常用命令

与 docker 命令是类似的,将 docker 命令直接替换为 podman 就行

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
root@server:~# podman -h
Manage pods, containers and images

Usage:
  podman [options] [command]

Available Commands:
  attach      Attach to a running container
  auto-update Auto update containers according to their auto-update policy
  build       Build an image using instructions from Containerfiles
  commit      Create new image based on the changed container
  container   Manage containers
  cp          Copy files/folders between a container and the local filesystem
  create      Create but do not start a container
  diff        Display the changes to the object's file system
  events      Show podman events
  exec        Run a process in a running container
  export      Export container's filesystem contents as a tar archive
  generate    Generate structured data based on containers, pods or volumes.
  healthcheck Manage health checks on containers
  help        Help about any command
  history     Show history of a specified image
  image       Manage images
  images      List images in local storage
  import      Import a tarball to create a filesystem image
  info        Display podman system information
  init        Initialize one or more containers
  inspect     Display the configuration of object denoted by ID
  kill        Kill one or more running containers with a specific signal
  load        Load image(s) from a tar archive
  login       Login to a container registry
  logout      Logout of a container registry
  logs        Fetch the logs of one or more containers
  machine     Manage a virtual machine
  manifest    Manipulate manifest lists and image indexes
  mount       Mount a working container's root filesystem
  network     Manage networks
  pause       Pause all the processes in one or more containers
  play        Play containers, pods or volumes from a structured file.
  pod         Manage pods
  port        List port mappings or a specific mapping for the container
  ps          List containers
  pull        Pull an image from a registry
  push        Push an image to a specified destination
  rename      Rename an existing container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Removes one or more images from local storage
  run         Run a command in a new container
  save        Save image(s) to an archive
  search      Search registry for image
  secret      Manage secrets
  start       Start one or more containers
  stats       Display a live stream of container resource usage statistics
  stop        Stop one or more containers
  system      Manage podman
  tag         Add an additional name to a local image
  top         Display the running processes of a container
  unmount     Unmounts working container's root filesystem
  unpause     Unpause the processes in one or more containers
  unshare     Run a command in a modified user namespace
  untag       Remove a name from a local image
  version     Display the Podman Version Information
  volume      Manage volumes
  wait        Block on one or more containers

Options:
      --cgroup-manager string      Cgroup manager to use ("cgroupfs"|"systemd") (default "systemd")
      --cni-config-dir string      Path of the configuration directory for CNI networks (default "/usr/libexec/cni")
      --conmon string              Path of the conmon binary
  -c, --connection string          Connection to use for remote Podman service
      --events-backend string      Events backend to use ("file"|"journald"|"none") (default "journald")
      --help                       Help for podman
      --hooks-dir strings          Set the OCI hooks directory path (may be set multiple times) (default [/usr/share/containers/oci/hooks.d])
      --identity string            path to SSH identity file, (CONTAINER_SSHKEY)
      --log-level string           Log messages above specified level (trace, debug, info, warn, warning, error, fatal, panic) (default "warn")
      --namespace string           Set the libpod namespace, used to create separate views of the containers and pods on the system
      --network-cmd-path string    Path to the command for configuring the network
  -r, --remote                     Access remote Podman service (default false)
      --root string                Path to the root directory in which data, including images, is stored
      --runroot string             Path to the 'run directory' where all state information is stored
      --runtime string             Path to the OCI-compatible binary used to run containers, default is /usr/bin/runc
      --runtime-flag stringArray   add global flags for the container runtime
      --storage-driver string      Select which storage driver is used to manage storage of images and containers (default is overlay)
      --storage-opt stringArray    Used to pass an option to the storage driver
      --syslog                     Output logging information to syslog as well as the console (default false)
      --tmpdir string              Path to the tmp directory for libpod state content.

                                   Note: use the environment variable 'TMPDIR' to change the temporary storage location for container images, '/var/tmp'.

      --url string                 URL to access Podman service (CONTAINER_HOST) (default "unix:/run/podman/podman.sock")
  -v, --version                    version for podman
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
【运维路不弯】最简单的k8s集群搭建(基于ubuntu22.04 cloud-img)
指剑
2023/12/27
6550
podman快速入门详解与实践
Podman 原来是 CRI-O 项目的一部分,后来被分离成一个单独的项目叫 libpod。Podman 的使用体验和 Docker 类似,不同的是 Podman 没有 daemon。以前使用 Docker CLI 的时候,Docker CLI 会通过 gRPC API 去跟 Docker Engine 说「我要启动一个容器」,然后 Docker Engine 才会通过 OCI Container runtime(默认是 runc)来启动一个容器。这就意味着容器的进程不可能是 Docker CLI 的子进程,而是 Docker Engine 的子进程。
互联网-小阿宇
2022/11/21
1.5K0
【Podman】podman入门学习 | Docker替代品
在上手程度上:Podman 的操作方式与 Docker 高度兼容,很适合docker用户转型使用podman。使用命令几乎和docker相同
宝耶需努力
2022/12/13
2.7K0
【Podman】podman入门学习 | Docker替代品
win10/Win11在任意位置安装/配置Linux子系统WSL Ubuntu--WSL Ubuntu最全配置攻略
*1.把WSL 1设置为默认版本 以管理员身份打开Powershell,输入命令 wsl --set-default-version 1
coffee1
2025/01/17
1.8K0
第三章 Docker与编程语言
在容器运行的过程中,无论进行了什么操作,一旦容器退出或者重启,里面的数据都会被清空,这就是容器的生命周期。
喵喵侠
2022/01/23
9600
Docker 大势已去,Podman 即将崛起
点击上方“芋道源码”,选择“设为星标” 管她前浪,还是后浪? 能浪的浪,才是好浪! 每天 10:33 更新文章,每天掉亿点点头发... 源码精品专栏 原创 | Java 2021 超神之路,很肝~ 中文详细注释的开源项目 RPC 框架 Dubbo 源码解析 网络应用框架 Netty 源码解析 消息中间件 RocketMQ 源码解析 数据库中间件 Sharding-JDBC 和 MyCAT 源码解析 作业调度中间件 Elastic-Job 源码解析 分布式事务中间件 TCC-Transaction
芋道源码
2022/03/04
1K0
ubuntu 18.0.4 降级安装gcc 5
项目当前使用的ubuntu版本是 18.04(如何查看当前linux版本见文章最后), 默认安装的gcc版本是7.5.0, 在这环境编译出来的deb包在银河麒麟v10 sp1系统上可以兼容,但是在银河麒麟v10 的OS上会出现兼容性的问(原因是银河麒麟v10上运行的deb需要使用gcc 5进行编译),因此需要在ubuntu 18.04版本上安装gcc 5 的版本
艳龙
2022/03/08
2.3K0
docker 操作进阶
sudo docker exec -it merlingpu env LANG=C.UTF-8 /bin/bash
AI拉呱
2021/01/14
5130
Docker 最佳实战:Ubuntu 22.04 LTS 在线安装 Docker
今天分享的内容是 Docker 最佳实战「2024」 系列文档中的 Ubuntu 22.04 LTS 在线安装 Docker。
运维有术
2024/07/06
3.2K0
Docker 最佳实战:Ubuntu 22.04 LTS 在线安装 Docker
kubeedge 安装部署(适用于Ubuntu)「建议收藏」
node.json内容(注意 metadata.name 需要和 edge.yaml 中一致)
全栈程序员站长
2022/09/13
2.2K0
RHEL Podman命令
Podman 是一个开源的容器运行时项目,可在大多数 Linux 平台上使用。Podman 提供与 Docker 非常相似的功能。正如前面提到的那样,它不需要在你的系统上运行任何守护进程,并且它也可以在没有 root 权限的情况下运行。 Podman 可以管理和运行任何符合 OCI(Open Container Initiative)规范的容器和容器镜像。Podman 提供了一个与 Docker 兼容的命令行前端来管理 Docker 镜像。
星哥玩云
2022/09/15
5970
Podman入门全指南:安装、配置与运行容器
在容器技术日益成熟的今天,许多开发者和系统管理员都在寻找Docker的替代品。Podman,作为一种相对较新的容器化工具,不仅提供了与Docker类似的功能,而且在安全性和效率上也有所增强。如果你对Docker感到满意,那么你可能会对Podman的无守护进程架构和根权限运行的能力感到惊喜。本文将带你走进Podman的世界,从最基本的安装到运行你的第一个容器,一步步展示这一工具的魅力和实用性。
一只牛博
2025/05/30
1.2K0
Podman入门全指南:安装、配置与运行容器
ubuntu 24/23/22/21/20/18/16/14 自动切换 apt 阿里云/清华/腾讯/华为/网易163 源
eisc
2024/06/14
8170
腾讯云TDP-树莓派3B(ubuntu 22.04 server)更换apt源
腾讯云TDP-树莓派3B(ubuntu 22.04 server)更换apt源 1.更换 /etc/apt/sources.list 里面的内容为下方配置(只用选腾讯或者中科大的就行 不要都写进去) 腾讯云源 deb http://mirrors.cloud.tencent.com/ubuntu-ports jammy main restricted deb http://mirrors.cloud.tencent.com/ubuntu-ports jammy-updates main restrict
root0day
2022/04/25
2.7K0
第二章 Docker与命令行
常见的有Ubuntu、Alpine、CentOS、Debian等。用下面的命令,可以下载Linux发行版镜像:
喵喵侠
2022/01/23
1.4K0
技术分享|在Ubuntu下编译安装GreatSQL
本文首发于GreatSQL社区,原创内容未经授权不得随意使用,转载请联系小编并注明来源。
老叶茶馆
2021/12/01
5050
ubuntu镜像下载_ubuntu最小镜像
PS:更新ubuntu 其他版本的源,直接修改ubuntu 的版本代号即可,例如 21.04 的版本代号是 hirsute 使用 vim 中的 :%s/[source]/[target]/g 全局替换文本
全栈程序员站长
2022/11/04
9.3K0
ubuntu安装docker详细步骤
执行 sudo docker run hello-world 的时候,如果你没有构建过这个hello-world镜像,或从其它地方拉取过这个镜像,docker自动去docker上拉取最新的hello-world 镜像
乱码三千
2021/07/29
1.6K0
ubuntu安装docker详细步骤
【K8s】kubeadm 安装 k8s 集群
本篇文章主要是通过 VMware 来创建虚拟机,在虚拟机上通过 kubeadm 安装 k8s 集群;
Librant
2025/01/13
4920
docker安装ffmpeg,alpine/ubuntu安装ffmpeg
docker安装ffmpeg,alpine/Ubuntu安装ffmpeg 这段时间项目中用到了ffmpeg,我们的项目是通过docker来部署的,我的tomcat基础镜像有的是Ubuntu,还有的是alpine,就遇到了一个问题,有时候会安装失败。接下来给大家带来安装教程-docker环境下。 一、alpine安装ffmpeg alpine镜像比较小,所以后面在docker方面可能用的比较多。 alpine软件包管理工具apk的基本使用 #查询openssh相关的软件包 apk search openss
码农笔录
2018/06/29
9.2K0
相关推荐
【运维路不弯】最简单的k8s集群搭建(基于ubuntu22.04 cloud-img)
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档