github.com/containerd/nerdctl@v1.7.7/pkg/labels/labels.go (about) 1 /* 2 Copyright The containerd Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 // Package labels defines labels that are set to containerd containers as labels. 18 // The labels are also passed to OCI containers as annotations. 19 package labels 20 21 const ( 22 // Prefix is the common prefix of nerdctl labels 23 Prefix = "nerdctl/" 24 25 // Namespace is the containerd namespace such as "default", "k8s.io" 26 Namespace = Prefix + "namespace" 27 28 // Name is a human-friendly name. 29 // WARNING: multiple containers may have same the name label 30 Name = Prefix + "name" 31 32 //Compose Project Name 33 ComposeProject = "com.docker.compose.project" 34 35 //Compose Service Name 36 ComposeService = "com.docker.compose.service" 37 38 //Compose Network Name 39 ComposeNetwork = "com.docker.compose.network" 40 41 //Compose Volume Name 42 ComposeVolume = "com.docker.compose.volume" 43 44 // Hostname 45 Hostname = Prefix + "hostname" 46 47 // ExtraHosts are HostIPs to appended to /etc/hosts 48 ExtraHosts = Prefix + "extraHosts" 49 50 // StateDir is "/var/lib/nerdctl/<ADDRHASH>/containers/<NAMESPACE>/<ID>" 51 StateDir = Prefix + "state-dir" 52 53 // Networks is a JSON-marshalled string of []string, e.g. []string{"bridge"}. 54 // Currently, the length of the slice must be 1. 55 Networks = Prefix + "networks" 56 57 // Ports is a JSON-marshalled string of []gocni.PortMapping . 58 Ports = Prefix + "ports" 59 60 // IPAddress is the static IP address of the container assigned by the user 61 IPAddress = Prefix + "ip" 62 63 // IP6Address is the static IP6 address of the container assigned by the user 64 IP6Address = Prefix + "ip6" 65 66 // LogURI is the log URI 67 LogURI = Prefix + "log-uri" 68 69 // PIDFile is the `nerdctl run --pidfile` 70 // (CLI flag is "pidfile", not "pid-file", for Podman compatibility) 71 PIDFile = Prefix + "pid-file" 72 73 // AnonymousVolumes is a JSON-marshalled string of []string 74 AnonymousVolumes = Prefix + "anonymous-volumes" 75 76 // Platform is the normalized platform string like "linux/ppc64le". 77 Platform = Prefix + "platform" 78 79 // Mounts is the mount points for the container. 80 Mounts = Prefix + "mounts" 81 82 // Bypass4netns is the flag for acceleration with bypass4netns 83 // Boolean value which can be parsed with strconv.ParseBool() is required. 84 // (like "nerdctl/bypass4netns=true" or "nerdctl/bypass4netns=false") 85 Bypass4netns = Prefix + "bypass4netns" 86 87 // StopTimeout is seconds to wait for stop a container. 88 StopTimeout = Prefix + "stop-timeout" 89 90 MACAddress = Prefix + "mac-address" 91 92 // PIDContainer is the `nerdctl run --pid` for restarting 93 PIDContainer = Prefix + "pid-container" 94 95 // Error encapsulates a container human-readable string 96 // that describes container error. 97 Error = Prefix + "error" 98 99 // NerdctlDefaultNetwork indicates whether a network is the default network 100 // created and owned by Nerdctl. 101 // Boolean value which can be parsed with strconv.ParseBool() is required. 102 // (like "nerdctl/default-network=true" or "nerdctl/default-network=false") 103 NerdctlDefaultNetwork = Prefix + "default-network" 104 ) 105 106 var ShellCompletions = []string{ 107 Bypass4netns + "=true", 108 Bypass4netns + "=false", 109 // Other labels should not be set via CLI 110 }