containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.07k stars 2.35k forks source link

Podman clone doesn't work when cloning into pod #15252

Closed hoshsadiq closed 2 years ago

hoshsadiq commented 2 years ago

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description I'm unable to clone a container into a pod.

Steps to reproduce the issue:

$ podman create --name nginx -p 8080:80 nginx:alpine
d3d223eb16c1f261664276c7b3902036f7a2fb4cabfefe4e5c3fa342de200b4c
$ podman pod create --name=nginx-pod --share net --publish=8080:80/tcp
0395e5c486e5c269c773892f7849c58c42185dc9d4b95e7b183b99b1de665483
$ podman container clone --pod=nginx-pod nginx nginx-cloned nginx:alpine
WARN[0000] At least one namespace was reset to the default configuration 
Error: invalid config provided: published or exposed ports must be defined when the pod is created: network cannot be configured when it is shared with a pod

Describe the results you received: It failed with an error relating to networking. I'm assuming this is because it's trying to clone to container with its networking configuration.

Describe the results you expected: It should have cloned the container into the pod without the network configuration.

Additional information you deem important (e.g. issue happens only occasionally): N/A

Output of podman version:

Client:       Podman Engine
Version:      4.1.1
API Version:  4.1.1
Go Version:   go1.16
Git Commit:   f73d8f8875c2be7cd2049094c29aff90b1150241
Built:        Tue Aug  9 07:38:28 2022
OS/Arch:      linux/amd64

Output of podman info:

host:
  arch: amd64
  buildahVersion: 1.26.1
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon_2.1.3-1_amd64
    path: /usr/local/libexec/podman/conmon
    version: 'conmon version 2.1.3, commit: '
  cpuUtilization:
    idlePercent: 61.13
    systemPercent: 9.38
    userPercent: 29.49
  cpus: 8
  distribution:
    codename: jammy
    distribution: pop
    version: "22.04"
  eventLogger: journald
  hostname: pop-os
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.18.10-76051810-generic
  linkmode: dynamic
  logDriver: journald
  memFree: 304005120
  memTotal: 16489074688
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun_1.5-1_amd64
    path: /usr/local/bin/crun
    version: |-
      crun version 1.5
      commit: 54ebb8ca8bf7e6ddae2eb919f5b82d1d96863dea
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_AUDIT_WRITE,CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_MKNOD,CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: ""
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns_100:1.1.8-4_amd64
    version: |-
      slirp4netns version 1.1.8
      commit: unknown
      libslirp: 4.3.1-git
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.1
  swapFree: 13071134720
  swapTotal: 17180389376
  uptime: 317h 37m 51.51s (Approximately 13.21 days)
plugins:
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /home/hosh/.config/containers/storage.conf
  containerStore:
    number: 7
    paused: 0
    running: 3
    stopped: 4
  graphDriverName: vfs
  graphOptions: {}
  graphRoot: /home/hosh/.local/share/containers/storage
  graphRootAllocated: 481245339648
  graphRootUsed: 348285595648
  graphStatus: {}
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 35
  runRoot: /run/user/1000/containers
  volumePath: /home/hosh/.local/share/containers/storage/volumes
version:
  APIVersion: 4.1.1
  Built: 1660027108
  BuiltTime: Tue Aug  9 07:38:28 2022
  GitCommit: f73d8f8875c2be7cd2049094c29aff90b1150241
  GoVersion: go1.16
  Os: linux
  OsArch: linux/amd64
  Version: 4.1.1

Package info (e.g. output of rpm -q podman or apt list podman):

Listing...
podman/now 100:4.1.1-1 amd64 [installed,local]

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

Yes

Additional environment details (AWS, VirtualBox, physical, etc.): Physical. Pop-OS 22.04

cdoern commented 2 years ago

Thanks for reaching out! I feel as thought this is expected behavior. The goal of this command is to clone a container, we already overwrite a lot of the namespace info. I do not think changing the network config should be done. At that point, you might as well make a new container, not clone it.

hoshsadiq commented 2 years ago

Seems reasonable. Okay, thanks!