# 集装箱
Podman:安装
安装Podman,这是容器管理工具。
可以使用Docker Cli相同的易用性,Podman不需要特定的Service Daemon。
```
[root@dlp ~]# dnf -y install podman
```
\[2\] | 下载官方图像并创建一个容器,并在容器内输出单词\[欢迎来到Podman World\]。 |
```
# download the official image
[root@dlp ~]# podman pull fedora
Resolved "fedora" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull registry.fedoraproject.org/fedora:latest...
Getting image source signatures
.....
.....
Writing manifest to image destination
Storing signatures
1b52edb0818147bea39780625ec01ab46944284acf16d8bcfa4055f8a854a9f5
# run echo inside a container
[root@dlp ~]# podman run fedora /bin/echo "Welcome to the Podman World"
Welcome to the Podman World
```
\[3\] | 使用如下所示的\[i\]和\[t\]选项连接到容器的交互式会话。
如果从容器会话\[退出\],容器的过程将结束。 |
```
[root@dlp ~]# podman run -it fedora /bin/bash
[root@c466d78a528d /]# # connected
[root@c466d78a528d /]# uname -a
Linux c466d78a528d 5.14.10-300.fc35.x86_64 #1 SMP Thu Oct 7 20:48:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[root@c466d78a528d /]# exit
exit
[root@dlp ~]# # come back
```
\[4\] | 如果您想将容器作为守护进程运行,请添加\[d\]选项。 |
```
[root@dlp ~]# podman run -itd fedora /bin/bash
0c5954f2e21190f86c892de6e256951c1d5576b5d2aa00be6b799778709f56c9
# show podman proceses
[root@dlp ~]# podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0c5954f2e211 registry.fedoraproject.org/fedora:latest /bin/bash 11 seconds ago Up 11 seconds ago funny_jang
# attach to container session
[root@dlp ~]# podman exec -it 0c5954f2e211 /bin/bash
[root@0c5954f2e211 /]# # connected
[root@0c5954f2e211 /]# exit
# stop container process (if force stop, specify [kill])
[root@dlp ~]# podman stop 0c5954f2e211
[root@dlp ~]# podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
```