易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 408|回复: 2
收起左侧

linux8系统安装调试podman

[复制链接]
发表于 2023-2-10 21:51:16 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
[root@controller ~]# dnf module list  |grep container-tools, k5 O! C: X7 g$ t
container-tools      rhel8 [d][e]    common [d]                               Most recent (rolling) versions of podman, buildah, skopeo, runc, conmon, runc, conmon, CRIU, Udica, etc as well as dependencies such as container-selinux built and tested together, and updated as frequently as every 12 weeks.         
! `, p- ~& P- l! h  n/ n: \5 Hcontainer-tools      1.0             common [d]                               Stable versions of podman 1.0, buildah 1.5, skopeo 0.1, runc, conmon, CRIU, Udica, etc as well as dependencies such as container-selinux built and tested together, and supported for 24 months.                                          
& }8 p0 t1 f$ rcontainer-tools      2.0             common [d]                               Stable versions of podman 1.6, buildah 1.11, skopeo 0.1, runc, conmon, etc as well as dependencies such as container-selinux built and tested together, and supported as documented on the Application Stream lifecycle page.             , i! I# P1 \, t! X  r2 ~4 S3 `
container-tools      3.0             common [d]                               Stable versions of podman 3.0, buildah 1.19, skopeo 1.2, runc, conmon, CRIU, Udica, etc as well as dependencies such as container-selinux built and tested together, and supported as documented on the Application Stream lifecycle page.4 B/ ~1 p+ P2 f2 o
container-tools      4.0             common                                   Stable versions of podman 4.0, buildah 1.24, skopeo 1.6, runc, conmon, CRIU, Udica, etc as well as dependencies such as container-selinux built and tested together, and supported as documented on the Application Stream lifecycle page.9 P+ T2 z( |' z2 l; \/ u: |

+ T8 q+ a/ V! B' D5 @4 V9 [( F, r2 B7 ^6 Z1 D  I; \6 k

1 s+ e. p3 H4 B+ ?+ ~/ P# V[root@controller ~]# dnf install -y @container-tools
- ?3 v- j" Q1 K/ E# `Last metadata expiration check: 0:43:52 ago on Fri 10 Feb 2023 09:03:30 PM CST.5 E, N! Q! E2 F2 ]* c( p
" y! {* Y7 {8 }) ?' C
(22/27): python3-chardet-3.0.4-7.el8.noarch.rpm                                   3.1 MB/s | 195 kB     00:00   
6 i4 z1 ^# O1 L( `* }$ ^% d(23/27): python3-idna-2.5-5.el8.noarch.rpm                                        1.2 MB/s |  97 kB     00:00    9 U+ @4 f, T6 J" K
(24/27): python3-pysocks-1.6.8-3.el8.noarch.rpm                                   765 kB/s |  34 kB     00:00   
% x/ ^* q& Y5 V. q8 c, J; `(25/27): python3-requests-2.20.0-2.1.el8_1.noarch.rpm                             2.3 MB/s | 123 kB     00:00   
: ?: M. V+ g2 @* [9 }(26/27): python3-urllib3-1.24.2-5.el8.noarch.rpm                                  2.9 MB/s | 177 kB     00:00    ( _) r8 J. t+ b. G
(27/27): gsettings-desktop-schemas-3.32.0-6.el8.x86_64.rpm                        1.9 MB/s | 633 kB     00:00   
: K( z0 t! Q: B- d$ d, f------------------------------------------------------------------------------------------------------------------1 H) y( ^+ u4 U6 O1 A
Total                                                                             8.7 MB/s |  24 MB     00:02     - v) {1 W* \; z6 t
Running transaction check% J/ b" j' `. L* {
Transaction check succeeded.
( P+ n0 f+ z6 G; j3 f$ M; aRunning transaction test
% X  C0 A( r( J/ M% OTransaction test succeeded.. w* H, N" a6 G" r1 I
Running transaction% [: _% _' K! R$ `. K3 [! i
  Preparing        :                                                                                          1/1 1 W" u% G8 X+ _  ~: H  t
  Installing       : fontpackages-filesystem-1.44-22.el8.noarch                                              1/27
) Q9 @) l' Y; O9 r4 z" p5 z  Installing       : abattis-cantarell-fonts-0.0.25-6.el8.noarch                                             2/27
% v# ?. F3 c( v9 ~; Y  g0 ?  Installing       : dejavu-fonts-common-2.35-7.el8.noarch                                                   3/27
" ]; b$ V' x3 H7 e) X$ e* v  Installing       : dejavu-sans-mono-fonts-2.35-7.el8.noarch                                                4/27 0 \3 M2 r: J' E! g4 V2 v5 ^
  Installing       : gsettings-desktop-schemas-3.32.0-6.el8.x86_64                                           5/27 , g/ h( N6 K% X* P
  Installing       : python3-pysocks-1.6.8-3.el8.noarch                                                      6/27 4 T, b$ R$ Z9 o- o" }+ x
  Installing       : python3-urllib3-1.24.2-5.el8.noarch                                                     7/27
" a& G' s  Z. S+ T  u  Installing       : python3-idna-2.5-5.el8.noarch                                                           8/27
# l$ Q% t) k# J! E  Installing       : python3-chardet-3.0.4-7.el8.noarch                                                      9/27
+ S6 V4 \# V7 x$ F  k6 Q  Installing       : python3-requests-2.20.0-2.1.el8_1.noarch                                               10/27 / {6 A9 H+ n/ c; l+ O1 G
  Installing       : libmodman-2.0.1-17.el8.x86_64                                                          11/27
6 g5 \' k  L2 W; y: [  Running scriptlet: libmodman-2.0.1-17.el8.x86_64                                                          11/27
/ ]1 k; {( k, O! ], f! K; l  Installing       : libproxy-0.4.15-5.2.el8.x86_64                                                         12/27
# I  M/ n% V2 q1 }5 ?" t  Running scriptlet: libproxy-0.4.15-5.2.el8.x86_64                                                         12/27
  H1 G9 @) [; y( p8 w  Installing       : glib-networking-2.56.1-1.1.el8.x86_64                                                  13/27 / |/ @0 u9 z% o; i+ q
  Installing       : json-glib-1.4.4-1.el8.x86_64                                                           14/27
; j' K% z: Q* [4 \* W- D2 f  Installing       : cockpit-bridge-283-1.el8.x86_64                                                        15/27 4 e# ^; c- i( }9 y. B$ |
  Installing       : yajl-2.1.0-11.el8.x86_64                                                               16/27
3 m- K5 f" Y( t1 h/ h* E  Installing       : python3-pyxdg-0.25-16.el8.noarch                                                       17/27 5 Q; J3 ^1 @' w+ Q& W' r( v
  Installing       : python3-pytoml-0.1.14-5.git7dea353.el8.noarch                                          18/27
9 u1 W# }1 k7 N/ u1 T8 j! v5 u4 \  Installing       : aardvark-dns-2:1.1.0-4.module_el8.7.0+1216+b022c01d.x86_64                             19/27 . M; n4 n" O1 n- f* W: S# Y
  Installing       : netavark-2:1.1.0-6.module_el8.7.0+1216+b022c01d.x86_64                                 20/27 5 q% S& d9 T8 Y/ M+ Z) \
  Installing       : buildah-1:1.27.0-2.module_el8.7.0+1216+b022c01d.x86_64                                 21/27 * A& E3 W3 ~: ]. A
  Installing       : python3-podman-4.2.0-1.module_el8.7.0+1216+b022c01d.noarch                             22/27
4 _( j. U! g* n  Installing       : crun-1.5-1.module_el8.7.0+1216+b022c01d.x86_64                                         23/27
$ o& {6 `5 O8 [8 ?3 m7 X  Installing       : cockpit-podman-53-1.module_el8.7.0+1216+b022c01d.noarch                                24/27
$ E4 K+ S. _5 _8 \! T7 I, P  Installing       : udica-0.2.6-3.module_el8.7.0+1216+b022c01d.noarch                                      25/27 $ Q1 B! }& |! y' v) |7 \% i
  Installing       : toolbox-0.0.99.3-1.module_el8.5.0+877+1c30e0c9.x86_64                                  26/27 8 F9 C4 _) s7 e  y; v
  Installing       : skopeo-2:1.9.2-1.module_el8.7.0+1216+b022c01d.x86_64                                   27/27
$ X9 C, F  E) w  Running scriptlet: skopeo-2:1.9.2-1.module_el8.7.0+1216+b022c01d.x86_64                                   27/27 6 a# j+ @/ }8 h% V6 ]- |
  Verifying        : aardvark-dns-2:1.1.0-4.module_el8.7.0+1216+b022c01d.x86_64                              1/27
& N) t- |% F7 t  Verifying        : abattis-cantarell-fonts-0.0.25-6.el8.noarch                                             2/27
& F; R6 l6 k9 ]' e9 g/ v- f$ p6 s  Verifying        : buildah-1:1.27.0-2.module_el8.7.0+1216+b022c01d.x86_64                                  3/27
6 S& ]- ~) J, x# S  Verifying        : cockpit-podman-53-1.module_el8.7.0+1216+b022c01d.noarch                                 4/27
6 _; E  ]4 z. E/ s* O# J  C  Verifying        : crun-1.5-1.module_el8.7.0+1216+b022c01d.x86_64                                          5/27
. a( s6 I7 F- X: I% y  Verifying        : netavark-2:1.1.0-6.module_el8.7.0+1216+b022c01d.x86_64                                  6/27
0 n. g9 d9 |# D2 `9 z9 h; k0 j  Verifying        : python3-podman-4.2.0-1.module_el8.7.0+1216+b022c01d.noarch                              7/27
* J( q* B, `, A, P* O: T/ c  Verifying        : python3-pytoml-0.1.14-5.git7dea353.el8.noarch                                           8/27
+ R6 ]4 v" F( r8 j  Verifying        : python3-pyxdg-0.25-16.el8.noarch                                                        9/27
. Y2 Z: u, L- I% ~- ^  Verifying        : skopeo-2:1.9.2-1.module_el8.7.0+1216+b022c01d.x86_64                                   10/27
% p. A* i5 `0 m# K  Verifying        : toolbox-0.0.99.3-1.module_el8.5.0+877+1c30e0c9.x86_64                                  11/27 . q0 A. K' G, Z) ]" p) v
  Verifying        : udica-0.2.6-3.module_el8.7.0+1216+b022c01d.noarch                                      12/27 6 r2 w1 B& j& S) I: W- l! X
  Verifying        : yajl-2.1.0-11.el8.x86_64                                                               13/27 & L2 a* [1 h; r
  Verifying        : cockpit-bridge-283-1.el8.x86_64                                                        14/27 9 a# A# [6 w' `/ q8 i
  Verifying        : dejavu-fonts-common-2.35-7.el8.noarch                                                  15/27 / r8 A! p! f" }. {* b& b7 e4 g4 g# v
  Verifying        : dejavu-sans-mono-fonts-2.35-7.el8.noarch                                               16/27 ! P  R5 g* G% E# X, d2 [
" o, J# u/ S$ y) j
Installed:+ X. u* a" a7 ]5 a0 G
  aardvark-dns-2:1.1.0-4.module_el8.7.0+1216+b022c01d.x86_64                                                      1 ~' Q  {% d8 D- J
  abattis-cantarell-fonts-0.0.25-6.el8.noarch                                                                     # j' D+ V! @8 z$ u
  buildah-1:1.27.0-2.module_el8.7.0+1216+b022c01d.x86_64                                                         
- @1 I; b' }4 i. J2 ~5 c  cockpit-bridge-283-1.el8.x86_64                                                                                 
1 L# {. N, A  s2 |  cockpit-podman-53-1.module_el8.7.0+1216+b022c01d.noarch                                                         
' B$ O6 C1 g" F4 Q! p1 ~  crun-1.5-1.module_el8.7.0+1216+b022c01d.x86_64                                                                  
6 I/ d1 ?7 e! e1 m  _6 |  dejavu-fonts-common-2.35-7.el8.noarch                                                                           5 k/ K4 i. [4 I2 e0 i% H( @
  dejavu-sans-mono-fonts-2.35-7.el8.noarch                                                                        - k' t+ T$ ]* Y9 X+ N
  fontpackages-filesystem-1.44-22.el8.noarch                                                                      ) c9 v; J7 B  f. W0 k7 {
  glib-networking-2.56.1-1.1.el8.x86_64                                                                           # v3 |8 G; [0 |& g: N3 n1 k- R) x! G
  gsettings-desktop-schemas-3.32.0-6.el8.x86_64                                                                   9 R1 D' T/ ~6 F( J/ T7 R1 o+ N: f* G
  json-glib-1.4.4-1.el8.x86_64                                                                                    $ n3 `' T3 P2 d; }8 r
  libmodman-2.0.1-17.el8.x86_64                                                                                   
. F  t! ~! @, \: v6 p* z6 Z8 l  libproxy-0.4.15-5.2.el8.x86_64                                                                                  7 e, G) W1 ]% i; W7 @( ~1 N" x
  netavark-2:1.1.0-6.module_el8.7.0+1216+b022c01d.x86_64                                                         
0 w* J! Z7 _2 S/ x3 E  python3-chardet-3.0.4-7.el8.noarch                                                                              ( w2 y& H. `! |
  python3-idna-2.5-5.el8.noarch                                                                                   
- k  e1 l6 A9 f# y  python3-podman-4.2.0-1.module_el8.7.0+1216+b022c01d.noarch                                                      / O; t" k% v4 [7 n1 V
  python3-pysocks-1.6.8-3.el8.noarch                                                                              
, H! }$ V4 {4 e+ F: n) e  python3-pytoml-0.1.14-5.git7dea353.el8.noarch                                                                  
) S, l5 [9 L+ {" i  python3-pyxdg-0.25-16.el8.noarch                                                                                
8 s  W# v# k% U- Y) r, d: ^  python3-requests-2.20.0-2.1.el8_1.noarch                                                                        
* z- G; L" _; |6 z  python3-urllib3-1.24.2-5.el8.noarch                                                                             , E6 Y* g5 ]  a) u* {; F
  skopeo-2:1.9.2-1.module_el8.7.0+1216+b022c01d.x86_64                                                            # B: w( E% L/ T& M3 o: i" G
  toolbox-0.0.99.3-1.module_el8.5.0+877+1c30e0c9.x86_64                                                           
4 N5 }9 @- K% Z/ z" B( @& M  udica-0.2.6-3.module_el8.7.0+1216+b022c01d.noarch                                                               9 L& O3 u) c/ j9 p9 }, D( e
  yajl-2.1.0-11.el8.x86_64                                                                                       
& Q! N4 ^0 c# u, a% f
2 I  N7 R: s7 ^* m% CComplete!
8 V* \7 K: t; d[root@controller ~]# ! \% S  l. Z4 K1 G+ n$ C

, k: \! y( x4 I# A5 T) E5 \4 @[root@controller ~]# podman version
5 l: U8 ?# m- A/ R4 a$ e& @Client:       Podman Engine( t) D" K/ g8 A
Version:      4.2.05 h/ L% i0 p4 o6 F
API Version:  4.2.0
+ Q# e# T. a2 JGo Version:   go1.18.4
) l/ y9 c( T: i. k# Y1 ZBuilt:        Wed Sep 21 21:15:04 2022/ \/ U2 ]% O% X# {
OS/Arch:      linux/amd64* s" m/ {2 w' @  `# d* i+ M5 Y2 @

- o8 t2 }/ |! n8 U0 `9 s% R" s
' Q  |8 x4 g: i9 U! g. s* l; j$ W: P. T

9 i2 V  [- T) {9 g
 楼主| 发表于 2023-2-10 22:07:55 | 显示全部楼层
可以发现,使用方式可以说和 docker 的丝毫不差,不用担心从 docker 切换到 podman 会有不习惯的。如果不习惯使用 podman 命令,可以使用 alias docker=podman 来对docker命令做一个命令映射即可:) P) b5 a& \2 l0 }7 ^1 b
$ j( a3 F- R* l6 O" Z; T3 t+ m! H) q  C
加速链接获取 详细请阅读docker 基本用法0 u8 O3 f- ?, @. D& U

2 z- V0 O/ J8 a- G- f默认镜像库 文件 /etc/containers/registries.conf 是设置镜像地址配置文件,默认会搜索 ['registry.access.redhat.com', 'registry.redhat.io', 'docker.io', 'quay.io']等几个镜像库
2 f% b4 F/ @3 J- v. M; D% x1 D/ Qunqualified-search-registries = ["registry.access.redhat.com", "registry.redhat.io", "docker.io"]
/ u. {$ E0 P! [/ V5 J
" {) H4 q' Z% y5 a. d& K1 [/ }9 Z
1 k9 P! z, |4 W     通常来说,这几个镜像库下载速度非常慢,有时候可能会无法顺利的将镜像拉下来。
$ @9 I0 P; x5 b! K3 P% a7 _' t
) O& ^0 ~+ a7 Q) H; J# `. H     所以,需要修改修改镜像库配置文件,也就是大家说的镜像加速方案。
& i$ N( F3 }1 V# J2 t! J镜像加速
* V/ J+ d  L+ f% e2 T2 D& `     只需2个步骤实现镜像加速:6 v4 J# w1 Z( C% {; Z1 _

% }( r2 M# N3 t+ H7 N           1.改名并备份好文件:/etc/containers/registries.conf.bak
8 ?8 s) {' }4 G) L% t. } ​cp /etc/containers/registries.conf{,.bak}( F" e& K& M3 M

7 m, {* c, [, G
) e% D4 t7 x3 d! W* H" P           2.再新建一个空的 registries.conf 文件,插入如下内容' h) t- n. }7 Z/ t" R8 O$ C  X8 c9 X+ [
                 unqualified-search-registries = ["docker.io"]
5 C, w% L! N2 i& c, k" M) F4 s  ~& N# Y5 F7 F& u
           #      [[registry]]- J% ^0 W* \4 Q7 ?
           #       prefix = "docker.io"7 A0 O: k: A+ a/ j9 J
            #      location = "******.mirror.aliyuncs.com"& ^1 |9 f) E0 J6 M
6 ?! D4 C, ^0 E6 M. ^2 c1 s
           3.修改 location
+ c, J* J; Q" f6 }4 O) o                网易:https://hub-mirror.c.163.com/
' L' B4 x. G7 a
& i, N* {) O/ K( L; C9 P                阿里云:https://<你的ID>.mirror.aliyuncs.com4 D& c. b) P" i! R
           4.保存$ \( }4 i# a. k2 `
配置:  U4 o" ?7 L& ]- t# [4 D6 \

# z. F, G3 S5 M2 S7 ]1 ~8 c3 P1 g8 j$ ?3 V8 M, T
: G% `- U' M- K9 [2 I( H

+ a9 H( K: o* r! E0 p8 K # 修改podman镜像源) z* d# }; F4 l, B8 ^6 Z$ f
[root@podman ~]# vim /etc/containers/registries.conf
. r- B" }5 A' Z4 f' u unqualified-search-registries = ["docker.io"]0 T" A7 e* _& M6 K8 @9 p3 W: ~) q3 o
  #podman默认的镜像拉取镜像地址第一个是红帽的,改成docker的  ,下面的也可以不配置:
- g8 [! G! N) d9 [) h5 d  # [[registry]]
' ]# g6 R- G3 V$ P) P) ^' S# prefix = "docker.io"
  t4 e: I* r* O9 C! ]) l# location = "fi54miqv.mirror.aliyuncs.com"5 Z6 X8 j# i" l3 @# u3 `# F1 X
#试一下% p! n9 \  L( ~) c- t( g% }7 L
[root@podman ~]# podman login
. h4 M# T/ Y; f+ ~+ p8 ~' g" h Username: **********
. c; D: p2 m8 W: `% ? Password: 9 ]# b* z3 k. m
Login Succeeded!
5 A9 T4 }- J+ T: ^4 Q2 Y% F% Z操作0 d) e' K4 g/ ]/ F' P
+ U! v% M5 `! b) t: c8 k
[root@controller containers]# podman pull httpd9 t5 ~; |. [* t# b$ m+ ^3 L8 U
Resolving "httpd" using unqualified-search registries (/etc/containers/registries.conf)
" v6 P% ^4 o4 Q1 a' K2 ?  \, h$ HTrying to pull docker.io/library/httpd:latest...; M  N. x# K2 `4 V# ]
Getting image source signatures
' Q7 X. |# w" m% UCopying blob b7f64f2f8747 done  8 O: A# ^. b: O
Copying blob b7f64f2f8747 done  
) x) ?3 j  ~$ L" m3 z! HCopying blob 9e8776e4b876 done  , Z8 C6 N0 A" y" R
Copying blob bb263680fed1 done  
" D  J9 S# V& H' yCopying blob f506d7aab652 done  9 H3 y! w7 I( K3 o" T( w) Z9 _6 h
Copying blob 05289ee4f284 done  
& T4 M& R4 D1 Y( v' ?7 u/ rCopying config 3a4ea134cf done  ' ?( i# m# b7 Q5 k7 P8 M  T
Writing manifest to image destination
+ I  x3 k2 s& r; M6 K! E- ^Storing signatures4 ]. _  H' H# h
3a4ea134cf8e081516a776ce184dedc28986f941ed214b9012dc888049480f5a* d% U  y: O% u8 Q9 q3 Y- o% L+ t
[root@controller containers]#
7 ]9 G+ S. N- A8 `: _[root@controller containers]# podman ps
' M5 ?' ]! ?& L& DCONTAINER ID  IMAGE       COMMAND     CREATED     STATUS      PORTS       NAMES
: |6 M4 D4 y6 I; w" y0 A  I[root@controller containers]# podman image ls
) X2 R  @8 }1 c3 ?  \REPOSITORY               TAG         IMAGE ID      CREATED       SIZE0 y- m6 i3 \3 C  E% ^
docker.io/library/httpd  latest      3a4ea134cf8e  34 hours ago  150 MB
3 y% M* b" j; N[root@controller containers]# podman  image rm 3a4ea134cf8e
: H- F7 @% e8 W" p4 }. bUntagged: docker.io/library/httpd:latest3 h" g  f1 U7 h) H1 w3 X' k, a! j
Deleted: 3a4ea134cf8e081516a776ce184dedc28986f941ed214b9012dc888049480f5a
, t/ L: Q2 I7 P
5 J% q" {) o4 }, m- b. M
4 o( v- [4 \: B. r# K/ p3 Y" u% C- p$ c" C
[root@podman ~]# podman run -d --name httpd docker.io/library/httpd:latest$ \! t' A5 Q1 o" K* c
2684bce8b0b52a51fe9fbb6081b057e51a3b455da68fedae2a69868607728eab
2 u+ c6 G7 ?, s4 f% A9 |3 J [root@podman ~]# podman ps- }3 _: w+ q7 e* Z8 y1 x
CONTAINER ID  IMAGE                           COMMAND           CREATED        STATUS            PORTS       NAMES6 Z6 v: ?% K( {) e" c
2684bce8b0b5  docker.io/library/httpd:latest  httpd-foreground  5 seconds ago  Up 5 seconds ago              httpd
' h  W( @. R9 n, i. q, R
- x5 I- i5 ]4 S0 f: m: M/ }; w$ N, A# j4 J7 g
[root@podman ~]# podman exec -it httpd /bin/bash
, z% N) _! B$ t root@2684bce8b0b5:/usr/local/apache2# 9 a% d3 ~+ {! l
podman export将容器的文件系统内容导出为 tar 存档" J. ~) E- y: N( H- Y0 b  f# C8 ~$ H
history显示指定图像的
( J9 a5 M% C  w4 Y images列出本地存储中的图像3 @: Z' E  P2 j8 F
导入tarball 以创建文件系统映像* W/ P. F$ ?4 s2 k1 g: R
info显示 podman 系统信息
" U0 Z9 N* W; ~2 z init初始化一个或多个容器8 ?7 D9 U, K) [/ G1 P  K
kill用特定的信号杀死一个或多个正在运行的容器
5 \/ E2 {) g, K+ u$ Z2 d kube play等
/ A, B4 j  q# ~. t) A1 a8 K logs获取容器的日志、
" O* X/ j( k& ]3 \, R machine管理 podman 的虚拟机& N; F3 K" q6 f6 w% \7 U
manifest创建和操作清单列表和图像索引
; C- Y0 q! S) r1 a3 d% o mount挂载一个工作容器的根文件系统% Q! _( V6 i2 b; R( P
pause暂停一个或多个容器中的所有进程1 [: `' [3 p) A
pod管理 pod* d2 I" y) g+ }/ M7 x& _2 t( v
port列出端口映射或容器的特定映射% L3 s; Q' B. d. U
ps列出容器- [7 m. F; z- P0 p" Z( M
push将图片推送到指定目的地4 U; f8 o* \1 }6 X$ ^* [
rename重命名现有容器
! |  w2 ?& ^4 \5 S; h. k+ g2 w4 y# B' m( y
) a7 D- B; M* h( N
 楼主| 发表于 2023-2-10 22:10:35 | 显示全部楼层
Podman是一个开源的容器管理工具,语法兼容 Docker,但是某些方面比原生 Docker 命令更好用,比如能够以非root用户的身份去运行容器,而且不需要守护进程。
4 a0 [) T# ]% x3 q
" @3 A  [; p4 w2 y$ Y. ]Podman引入了一个注册表的概念,注册表就是包括 ​ ​docker.io​​ 在内的多个容器镜像源,默认的有 redhat docker fedora centos quay。
6 C0 z" u' Z+ K- q* P  K! f% y$ e2 c9 I) Y
国内直接用 podman pull 拉取镜像会很慢,所以需要配置国内镜像源来加速访问。* m/ E# x, g9 W* Z% {$ z( n

  H! g5 X! W& t5 f" r7 e" ?- B国内的镜像源有以下:
. M) @7 o7 x" e
+ [/ N9 |( G0 s( z3 Kdocker官方中国区:  https://registry.docker-cn.com: z- B& j* c$ s4 p# w
网易:             http://hub-mirror.c.163.com
! q$ ^5 @/ S' Z3 T/ r' y( y: }USTC:            http://docker.mirrors.ustc.edu.cn# ]+ F* \5 e3 g1 g# ^
阿里云:           http://<你的ID>.mirror.aliyuncs.com8 R% v! ~- l/ Y
1.
6 R2 a: A% p5 d6 a5 }: Y5 A2.* P4 \% ~* n* h2 ]" e. O
3.) K3 H7 ~4 h! n: u* E
4.
4 o8 r  Z# l6 o此处我使用的是阿里的镜像源
3 S" @: }) ?& V3 j5 k0 u* H8 x4 i3 K" m) w
5 s$ y! y, e5 P1.获取阿里的镜像源地址# Y: z6 J1 R; Z9 X& s4 `
<你的ID>.mirror.aliyuncs.com! b1 k0 d, \. b. Q1 d. K, y8 T
1.6 O% f/ l7 R! _* i" E
2.修改Podman的注册表配置文件
) u7 S  b7 ?5 u1 p) l' |vim  /etc/containers/registries.conf% U- u0 @# `% I
1.3 e4 ^0 _0 I; d# H
修改内容' u$ a5 G/ ^# D, e; D

1 L5 b2 p+ H& ^" {/ B" o) J登录后复制
9 @1 _" J6 d1 E/ g( punqualified-search-registries = ["docker.io"]( Z0 X( \/ c+ \& m$ l
1.* R9 }4 V8 ~/ g' }
增加内容
  |% l; _/ B% J/ m2 s/ i5 I6 W2 P* U* [+ C
[[registry]]2 D7 B& z5 q1 R1 U4 V' h
prefix = "docker.io"
) X2 N+ N5 Q3 @) }location="d1234.mirror.aliyuncs.com"" d: z4 L! F' `4 _  j
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 21:40 , Processed in 0.052264 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

快速回复 返回顶部 返回列表