簡體   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