Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't remove default network podman #16890

Open
desaes-br opened this issue Dec 20, 2022 · 10 comments
Open

Can't remove default network podman #16890

desaes-br opened this issue Dec 20, 2022 · 10 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@desaes-br
Copy link

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

/kind feature
/network

Description

Can't remove default network podman

Steps to reproduce the issue:

  1. obtain the default network via
    podman network ls

  2. Assuming you have only 1 network, try to remove it:
    podman network rm from Initial checkin #1

Describe the results you received:
Error: default network podman cannot be removed

Describe the results you expected:
I should be able to either remove it, or set a configuration like we can do via docker to disable it, eg:
cat /etc/docker/daemon.json
{
"bridge": "none"
}

Additional information you deem important (e.g. issue happens only occasionally):
Any time

Output of podman version:

podman version
Client:       Podman Engine
Version:      4.1.1
API Version:  4.1.1
Go Version:   go1.17.12
Built:        Wed Aug  3 16:36:19 2022
OS/Arch:      linux/amd64

Output of podman info:

podman info
host:
  arch: amd64
  buildahVersion: 1.26.2
  cgroupControllers:
  - cpuset
  - cpu
  - cpuacct
  - blkio
  - memory
  - devices
  - freezer
  - net_cls
  - perf_event
  - net_prio
  - hugetlb
  - pids
  - rdma
  cgroupManager: systemd
  cgroupVersion: v1
  conmon:
    package: conmon-2.1.2-2.module+el8.6.0+20721+d8d917a9.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.2, commit: 226e45e4f5c8e763435ceae775bac989048f45e1'
  cpuUtilization:
    idlePercent: 97.43
    systemPercent: 0.6
    userPercent: 1.96
  cpus: 52
  distribution:
    distribution: '"ol"'
    variant: server
    version: "8.6"
  eventLogger: file
  hostname: <REMOVED>
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.4.17-2136.315.3.el8uek.x86_64
  linkmode: dynamic
  logDriver: k8s-file
  memFree: 12489596928
  memTotal: 403645779968
  networkBackend: cni
  ociRuntime:
    name: runc
    package: runc-1.1.3-2.module+el8.6.0+20721+d8d917a9.x86_64
    path: /usr/bin/runc
    version: |-
      runc version 1.1.3
      spec: 1.0.2-dev
      go: go1.17.12
      libseccomp: 2.5.2
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_NET_RAW,CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.0-2.module+el8.6.0+20721+d8d917a9.x86_64
    version: |-
      slirp4netns version 1.2.0
      commit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383
      libslirp: 4.4.0
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.2
  swapFree: 17157320704
  swapTotal: 17179865088
  uptime: 100h 57m 56.23s (Approximately 4.17 days)
plugins:
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphRootAllocated: 2042626048
  graphRootUsed: 161001472
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 0
  runRoot: /run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 4.1.1
  Built: 1659569779
  BuiltTime: Wed Aug  3 16:36:19 2022
  GitCommit: ""
  GoVersion: go1.17.12
  Os: linux
  OsArch: linux/amd64
  Version: 4.1.1

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

rpm -q podman
podman-4.1.1-2.module+el8.6.0+20721+d8d917a9.x86_64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

No

Additional environment details (AWS, VirtualBox, physical, etc.):

physical env, but it shouldn't be relevant here

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 20, 2022
@Luap99
Copy link
Member

Luap99 commented Dec 20, 2022

Why do you want to remove the default network? That network is in memory it is impossible to remove it.

@desaes-br
Copy link
Author

all the containers will communicate trough unix socket (instead of tcp), I don't want the default network because I might have conflicts with the defined IP of my host, I would need to write some logic to detect the IP defined on my hosts and change the default network to a different CIDR (what would be not reliable).
Is there any plan to allow to remove this network? Since docker already supports it, we could have a flexibility to allow the same in podman?

@Luap99
Copy link
Member

Luap99 commented Jan 3, 2023

But docker does not allow to remove it via network rm, you have to configure it in a config file. How does it behave when the network is disabled, i.e. what network does docker use instead (host or none)?

@desaes-br
Copy link
Author

desaes-br commented Jan 4, 2023

Right, but if we create /etc/docker/daemon.json
{
"bridge": "none"
}

it won't create the default bridge network, the docker uses none. eg: of one docker with bridge none defined at daemon.json:

"NetworkSettings": {
"Bridge": "",
"SandboxID": "c3c7cd7566e4117d601796fb94252469f38f36b3a2c5d4f0dcbc6ae53d47746a",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/c3c7cd7566e4",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "b59a84593825ee986753f8c2675f1df03c7378d6e427b0c88ac7c8ec2c8f761a",
"EndpointID": "",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null
}
}
}

And look the op from network ls from docker at the same host:

docker network ls

NETWORK ID NAME DRIVER SCOPE
2568e6a149ca host host local
e6b067dea1ab none null local

Since podman is daemonless we should have a way to either remove it or disable if not required like docker does imo.

@github-actions
Copy link

github-actions bot commented Feb 4, 2023

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jul 29, 2023

@Luap99 This is waiting on you.

@Luap99
Copy link
Member

Luap99 commented Jul 31, 2023

Adding a config option to not create the default network is possible but what is the point of it?
If it is just about using --network none as default then it should already possible to set netns="none" in containers.conf.

In principle it is possible to have a option to not create a config for the default network but that will likely result in a big mess when implementing as we would need to change the actual defaults everywhere.

Also looks like docker does not handle it correctly either:

"Networks": {
"bridge": {

So it still uses the bridge name as network name despite bridge not existing. That seems terribly confusing to me.

@wesley800
Copy link

wesley800 commented Mar 9, 2024

What about preserving the default network behaviour for container creation, and add an option to disable the default network? If no default network is setup, an error of No default network can be shown when creating container without specifying --network.

@Luap99
Copy link
Member

Luap99 commented Mar 11, 2024

I still do not really understand the use case for this.
Podman does not create the bridge device unless a container is actually started on that network so it will not block any ip range by default. So such option would only remove it from podman network ls and well prevent users from using it but nothing prevents them from creating a second network so this shouldn't make a difference. IMO setting netns="none" in containers.conf should already do it what you want if you do not wish to use the default bridge.

@wesley800
Copy link

@Luap99 I agree with you. Sorry that I misunderstood about the netns="none" part. After setting it in containers.conf, new containers defaults to no network, and doesn't create any interface on startup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

4 participants