我正在尝试在创建 podman 容器后将网络添加到它。这些是我采取的步骤:
- 创建并启动一个容器:
podman run -it --name "container" --network=mgmtnet img_v1 /bin/bash
- 容器启动。
- 我现在停止容器
podman stop container
- 我在以下位置编辑 podman config.json 文件:/var/lib/containers/storage/overlay-containers/60dfc044f28b0b60f0490f351f44b3647531c245d1348084944feaea783a6ad5/userdata/config.json
我在命名空间部分添加了一个额外的 netns 路径。
"namespaces": [
{
"type": "pid"
},
{
"type": "network",
>> "path": "/var/run/netns/cni-8231c733-6932-ed54-4dee-92477014da6e",
>>[+] "path": "/var/run/netns/test_net"
},
{
"type": "ipc"
},
{
"type": "uts"
},
{
"type": "mount"
}
],
- 我启动容器
podman start container
我期望容器中的更改(一个额外的接口)。但这不会发生。另外,检查 config.json,我发现我的更改已经消失。
因此启动容器会删除 config.xml 中的更改。如何克服这一点?
额外信息:
[root@bng-ix-svr1 ~]# podman info
host:
BuildahVersion: 1.9.0
Conmon:
package: podman-1.4.2-5.module+el8.1.0+4240+893c1ab8.x86_64
path: /usr/libexec/podman/conmon
version: 'conmon version 2.0.1-dev, commit: unknown'
Distribution:
distribution: '"rhel"'
version: "8.1"
MemFree: 253316108288
MemTotal: 270097387520
OCIRuntime:
package: runc-1.0.0-60.rc8.module+el8.1.0+4081+b29780af.x86_64
path: /usr/bin/runc
version: 'runc version spec: 1.0.1-dev'
SwapFree: 5368705024
SwapTotal: 5368705024
arch: amd64
cpus: 16
hostname: bng-ix-svr1.englab.juniper.net
kernel: 4.18.0-147.el8.x86_64
os: linux
rootless: false
uptime: 408h 2m 41.08s (Approximately 17.00 days)
registries:
blocked: null
insecure: null
search:
- registry.redhat.io
- registry.access.redhat.com
- quay.io
- docker.io
store:
ConfigFile: /etc/containers/storage.conf
ContainerStore:
number: 4
GraphDriverName: overlay
GraphOptions: null
GraphRoot: /var/lib/containers/storage
GraphStatus:
Backing Filesystem: xfs
Native Overlay Diff: "true"
Supports d_type: "true"
Using metacopy: "false"
ImageStore:
number: 2
RunRoot: /var/run/containers/storage
VolumePath: /var/lib/containers/storage/volumes