繁体   English   中英

Podman:对 podman config.json 所做的更改不会在容器启动时持续存在

[英]Podman: Changes made to podman config.json do not persist on container start

我正在尝试在创建 podman 容器后将网络添加到它。 这些是我采取的步骤:

  • 创建并启动一个容器:
podman run -it --name "container" --network=mgmtnet img_v1 /bin/bash
  • 容器启动。
  • 我现在停止容器
    podman stop container
  • I edit the podman config.json file at: /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

那是对的。 Podman 生成 config.json 文件,用于指示 OCI 运行时如何运行容器。

下次重新启动容器时,直接对该文件所做的所有更改都将丢失。 OCI 运行时使用 config.json 文件来创建容器,然后不再使用它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM