Support docker-compose like default network behavior

Signed-off-by: Songmin Li <lisongmin@protonmail.com>
This commit is contained in:
Songmin Li
2024-12-17 20:34:26 +08:00
parent 376f0817e6
commit 2cfc617f9e
3 changed files with 37 additions and 5 deletions

View File

@ -110,6 +110,26 @@ x-podman:
By default `default_net_name_compat` is `false`. This will change to `true` at some point and the
setting will be removed.
## Compatibility of default network behavior between docker-compose and podman-compose
When there is no network defined (neither network-mode nor networks) in service,
The behavior of default network in docker-compose and podman-compose are different.
| Top-level networks | podman-compose | docker-compose |
| ------------------------------ | -------------------------- | -------------- |
| No networks | default | default |
| One network named net0 | net0 | default |
| Two networks named net0, net1 | podman(`--network=bridge`) | default |
| Contains network named default | default | default |
To enable compatibility between docker-compose and podman-compose, specify
`default_net_behavior_compat: true` under global `x-podman` key:
```yaml
x-podman:
default_net_behavior_compat: true
```
## Custom pods management
Podman-compose can have containers in pods. This can be controlled by extension key x-podman in_pod.