containers / quadlet

GNU General Public License v2.0
347 stars 14 forks source link

Containers don't listen on IPv6 #27

Closed XenGi closed 2 years ago

XenGi commented 2 years ago

PublishPort lines in the container file don't get properly translated for IPv6 sockets.

This container file:

[Unit]
Description=test container

[Container]
Image=httpd:latest
PublishPort=80:80
PublishPort=[::]:80:80

[Service]
Restart=always

[Install]
WantedBy=multi-user.target default.target

Should result in this service file:

# Automatically generated by quadlet-generator
[Unit]
Description=test container
RequiresMountsFor=%t/containers
SourcePath=/etc/containers/systemd/test.container

[X-Container]
Image=docker.io/httpd:latest
PublishPort=80:80
PublishPort=[::]:80:80

[Service]
Restart=always
Environment=PODMAN_SYSTEMD_UNIT=%n
KillMode=mixed
ExecStartPre=-rm -f %t/%N.cid
ExecStopPost=-/usr/bin/podman rm -f -i --cidfile=%t/%N.cid
ExecStopPost=-rm -f %t/%N.cid
Delegate=yes
Type=notify
NotifyAccess=all
SyslogIdentifier=%N
ExecStart=/usr/bin/podman run --name=systemd-%N --cidfile=%t/%N.cid --replace --rm -d --log-driver journald --pull=never --runtime /usr/bin/crun --cgroups=split --init --sdnotify=conmon --security-opt=no-new-privileges --cap-drop=all --mount type=tmpfs,tmpfs-size=512M,destination=/tmp --uidmap 0:0:1 --uidmap 1:1879048192:65536 --gidmap 0:0:1 --gidmap 1:1879048192:65536 -p=80:80 -p=[::]:80:80 docker.io/httpd:latest

[Install]
WantedBy=multi-user.target default.target

The -p80:80 ends up there but not the -p[::]:80:80. I guess it's a parsing error when the conversion from .container to .service file happens.

XenGi commented 2 years ago

The pull request is done and fixes this problem. Works like a charm on my end.