mirror of
https://github.com/containers/podman.git
synced 2025-08-01 05:54:53 +08:00
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:
@ -439,8 +439,12 @@ func ConvertContainer(container *parser.UnitFile, names map[string]string, isUse
|
|||||||
containerName, ok := container.Lookup(ContainerGroup, KeyContainerName)
|
containerName, ok := container.Lookup(ContainerGroup, KeyContainerName)
|
||||||
if !ok || len(containerName) == 0 {
|
if !ok || len(containerName) == 0 {
|
||||||
// By default, We want to name the container by the service name
|
// By default, We want to name the container by the service name
|
||||||
|
if strings.Contains(container.Filename, "@") {
|
||||||
|
containerName = "systemd-%P_%I"
|
||||||
|
} else {
|
||||||
containerName = "systemd-%N"
|
containerName = "systemd-%N"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set PODMAN_SYSTEMD_UNIT so that podman auto-update can restart the service.
|
// Set PODMAN_SYSTEMD_UNIT so that podman auto-update can restart the service.
|
||||||
service.Add(ServiceGroup, "Environment", "PODMAN_SYSTEMD_UNIT=%n")
|
service.Add(ServiceGroup, "Environment", "PODMAN_SYSTEMD_UNIT=%n")
|
||||||
|
Reference in New Issue
Block a user