UNPKG

1.44 kBTypeScriptView Raw
1/**
2 * Remove any invalid characters from Docker image name component
3 * `name` to make it a valid Docker image name component. If
4 * `hubOwner` is true, it ensures the name contains only alphanumeric
5 * characters.
6 *
7 * From https://docs.docker.com/engine/reference/commandline/tag/:
8 *
9 * > An image name is made up of slash-separated name components,
10 * > optionally prefixed by a registry hostname. The hostname must
11 * > comply with standard DNS rules, but may not contain
12 * > underscores. If a hostname is present, it may optionally be
13 * > followed by a port number in the format :8080. If not present,
14 * > the command uses Docker’s public registry located at
15 * > registry-1.docker.io by default. Name components may contain
16 * > lowercase letters, digits and separators. A separator is defined
17 * > as a period, one or two underscores, or one or more dashes. A
18 * > name component may not start or end with a separator.
19 * >
20 * > A tag name must be valid ASCII and may contain lowercase and
21 * > uppercase letters, digits, underscores, periods and dashes. A tag
22 * > name may not start with a period or a dash and may contain a
23 * > maximum of 128 characters.
24 *
25 * @param name Name component to clean up.
26 * @param hubOwner If `true` only allow characters valid for a Docker Hub user/org
27 * @return Valid Docker image name component.
28 */
29export declare function cleanImageName(name: string, hubOwner?: boolean): string;