summaryrefslogtreecommitdiff
path: root/cmd/podman/common/create_opts.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2020-10-29 15:54:33 -0500
committerbaude <bbaude@redhat.com>2020-11-09 15:08:58 -0600
commitb7b5b6f8e3072530f4c3fc07e5960e54c90729b5 (patch)
tree01352a9b52f5e6cc3b0c78390036010088e3097a /cmd/podman/common/create_opts.go
parent110a1d8f25c87739afe790ac2bc461937f17222a (diff)
downloadpodman-b7b5b6f8e3072530f4c3fc07e5960e54c90729b5.tar.gz
podman-b7b5b6f8e3072530f4c3fc07e5960e54c90729b5.tar.bz2
podman-b7b5b6f8e3072530f4c3fc07e5960e54c90729b5.zip
network aliases for container creation
podman can now support adding network aliases when running containers (--network-alias). It requires an updated dnsname plugin as well as an updated ocicni to work properly. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/common/create_opts.go')
-rw-r--r--cmd/podman/common/create_opts.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index 8b2efc988..4b52663c3 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -133,6 +133,7 @@ func stringMaptoArray(m map[string]string) []string {
// a specgen spec.
func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroupsManager string) (*ContainerCLIOpts, []string, error) {
var (
+ aliases []string
capAdd []string
cappDrop []string
entrypoint string
@@ -242,8 +243,11 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup
// network names
endpointsConfig := cc.NetworkingConfig.EndpointsConfig
cniNetworks := make([]string, 0, len(endpointsConfig))
- for netName := range endpointsConfig {
+ for netName, endpoint := range endpointsConfig {
cniNetworks = append(cniNetworks, netName)
+ if len(endpoint.Aliases) > 0 {
+ aliases = append(aliases, endpoint.Aliases...)
+ }
}
// netMode
@@ -262,6 +266,7 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup
// defined when there is only one network.
netInfo := entities.NetOptions{
AddHosts: cc.HostConfig.ExtraHosts,
+ Aliases: aliases,
CNINetworks: cniNetworks,
DNSOptions: cc.HostConfig.DNSOptions,
DNSSearch: cc.HostConfig.DNSSearch,