1. Use Host Networking
If you want your container to share the network namespace of the host (essentially bypassing the container-specific network):
bashpodman run --net=host ...
With host networking, the container will have the same network interfaces and IP address as the host machine.
2. Create a New Pod with a Specific Network
Podman allows you to group one or more containers under a "pod". All containers in a pod share the same network namespace. To create a new pod with a specific network:
bashpodman pod create --name mypod --network bridge
The --network bridge flag will attach the pod to a bridge network. Then, when you create containers in this pod, they'll use this network:
bashpodman run --pod mypod ...
3. Create Custom Networks
Podman allows you to create custom CNI configurations and networks. For example:
bashpodman network create --subnet 10.89.0.0/16 --gateway 10.89.0.1 mycustomnet
This creates a custom network named mycustomnet with the specified subnet and gateway. To run a container with this custom network:
bashpodman run --network mycustomnet ...
4. Modify Default Network Configuration
If you want to modify the default network configuration for new containers:
- Navigate to the directory with CNI configurations, typically
/etc/cni/net.d/. - Modify the
.conflistfiles. These are JSON files specifying the network configurations. - Restart the container or pod to apply the changes.
5. Remove a Custom Network
If you've created a custom network and wish to remove it:
bashpodman network rm mycustomnet
Important Notes:
- Ensure you have the necessary CNI plugins installed on your system.
- Making changes to the network can disrupt running containers. Consider stopping containers before making significant network changes.
- Always back up configuration files before modifying them.
If you have a specific network change or configuration in mind that isn't covered above, please clarify, and I can provide more detailed instructions.

0 Commentaires