quadlet: Don't put @ in container names for templated units

This is not supported by podman, so we make "foo@bar" into "foo_bar".

Signed-off-by: Alexander Larsson <alexl@redhat.com>
This commit is contained in:
Alexander Larsson
2023-12-20 15:26:08 +01:00
parent 51c1140fcb
commit 2df994ba0c

View File

@ -439,7 +439,11 @@ func ConvertContainer(container *parser.UnitFile, names map[string]string, isUse
containerName, ok := container.Lookup(ContainerGroup, KeyContainerName)
if !ok || len(containerName) == 0 {
// By default, We want to name the container by the service name
containerName = "systemd-%N"
if strings.Contains(container.Filename, "@") {
containerName = "systemd-%P_%I"
} else {
containerName = "systemd-%N"
}
}
// Set PODMAN_SYSTEMD_UNIT so that podman auto-update can restart the service.