Help us shape the future of Go! Take the 2026 Go Developer Survey

naming

package
v5.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package naming derives the names Compose uses for the Docker resources it manages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalContainerName

func CanonicalContainerName(c container.Summary) string

CanonicalContainerName returns the name a container goes by, without the leading slash nor the link aliases.

func ContainerName

func ContainerName(projectName string, service types.ServiceConfig, number int) string

ContainerName returns the name of the replica of a service: the container_name the service declares, or the default <project>-<service>-<number>.

func ContainerNameWithoutProject

func ContainerNameWithoutProject(c container.Summary) string

ContainerNameWithoutProject returns the name of a container as Compose displays it: without the project prefix, unless the service declares a custom container_name.

func DefaultContainerName

func DefaultContainerName(projectName, serviceName, index string) string

DefaultContainerName returns the <project>-<service>-<index> name Compose gives a container when the service declares no container_name.

func InServices

func InServices(containers []container.Summary, services []string) []container.Summary

InServices keeps the containers of the given services.

func LabelFilter

func LabelFilter(key, value string) string

LabelFilter returns a label filter string of the form "key=value".

func ProjectFilter

func ProjectFilter(projectName string) client.Filters

ProjectFilter selects the resources of a Compose project.

func ServiceFilter

func ServiceFilter(serviceName string) string

ServiceFilter returns the label filter selecting the resources of a service.

func WithoutProjectPrefix

func WithoutProjectPrefix(name, projectName, serviceName, number string) string

WithoutProjectPrefix strips the project prefix from a container name when it is the default name of the replica of the service, and returns it unchanged otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL