diff options
author | zhangguanzhang <zhangguanzhang@qq.com> | 2021-05-06 18:52:45 +0800 |
---|---|---|
committer | zhangguanzhang <zhangguanzhang@qq.com> | 2021-05-06 19:25:27 +0800 |
commit | c0de4a4d70a68e5afeb70a5f6c5c5fbd2ca0bcc2 (patch) | |
tree | f49bdcc3b348cd0b4268041bc6cc630d48de9722 /cmd | |
parent | ed6f399770946bb2e88f8b94e1d2f279208648d4 (diff) | |
download | podman-c0de4a4d70a68e5afeb70a5f6c5c5fbd2ca0bcc2.tar.gz podman-c0de4a4d70a68e5afeb70a5f6c5c5fbd2ca0bcc2.tar.bz2 podman-c0de4a4d70a68e5afeb70a5f6c5c5fbd2ca0bcc2.zip |
Fixes docker-compose cannot set static ip when use ipam
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/common/create_opts.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go index ca36d751e..77ac781a5 100644 --- a/cmd/podman/common/create_opts.go +++ b/cmd/podman/common/create_opts.go @@ -302,6 +302,11 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup staticIP := net.ParseIP(ep.IPAddress) netInfo.StaticIP = &staticIP } + // if IPAMConfig.IPv4Address is provided + if ep.IPAMConfig != nil && ep.IPAMConfig.IPv4Address != "" { + staticIP := net.ParseIP(ep.IPAMConfig.IPv4Address) + netInfo.StaticIP = &staticIP + } // If MAC address is provided if len(ep.MacAddress) > 0 { staticMac, err := net.ParseMAC(ep.MacAddress) |