containers / podlet

Generate Podman Quadlet files from a Podman command, compose file, or existing object
https://crates.io/crates/podlet
Mozilla Public License 2.0
322 stars 10 forks source link

Networks in a compose file will break podlet #21

Closed Nitrousoxide closed 9 months ago

Nitrousoxide commented 9 months ago

How:

Create a simple compose file with a compose moderated network like:

version: "3"
services:
  5etools-docker:
    container_name: 5etools-docker
    image: jafner/5etools-docker
    volumes:
      - /srv/remotemount/Databases/5etools:/usr/local/apache2/htdocs
#    ports:
#     - 5555:80/tcp
    networks:
      - 5etools_backend
    environment:
     - SOURCE=GITHUB
    restart: unless-stopped
networks:
  5etools_backend:
    name: 5etools_backend

which has network backend to a reverse proxy in another container

Expected:

Podlet would create a 5etools_backend.network quadlet file in addition to the *.container file

What happens:

❯ podman run --rm -v $PWD:$PWD -v $HOME/.config/containers/systemd/:/usr/share/containers/systemd/ -w $PWD --security-opt label=disable --pull=newer quay.io/k9withabone/podlet compose
Error: 
   0: Could not parse network `5etools_backend` as a valid podman network
   1: `name` is not supported

Location:
   src/quadlet/network.rs:37

Fix:

If Podlet sees a "name" in the "networks" section of compose file it should translate that to "NetworkName=" NetworkName=