diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-11-04 16:53:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 16:53:49 +0100 |
commit | 4fb7378ee4ca2af5d521f7f75b691d4fe00b089b (patch) | |
tree | 6570b9710ca377ed764e3074dc369ef55bc159d8 /libpod/container_validate.go | |
parent | 303191bf522db9af32cabd98a5309e3079da0eb0 (diff) | |
parent | 844d540d042fe7477e62f8cf28e524fcd756f6c8 (diff) | |
download | podman-4fb7378ee4ca2af5d521f7f75b691d4fe00b089b.tar.gz podman-4fb7378ee4ca2af5d521f7f75b691d4fe00b089b.tar.bz2 podman-4fb7378ee4ca2af5d521f7f75b691d4fe00b089b.zip |
Merge pull request #8156 from mheon/add_net_aliases_db
Add network aliases for containers to DB
Diffstat (limited to 'libpod/container_validate.go')
-rw-r--r-- | libpod/container_validate.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libpod/container_validate.go b/libpod/container_validate.go index 68cc095b7..fa809436e 100644 --- a/libpod/container_validate.go +++ b/libpod/container_validate.go @@ -115,5 +115,16 @@ func (c *Container) validate() error { destinations[vol.Dest] = true } + // Check that networks and network aliases match up. + ctrNets := make(map[string]bool) + for _, net := range c.config.Networks { + ctrNets[net] = true + } + for net := range c.config.NetworkAliases { + if _, ok := ctrNets[net]; !ok { + return errors.Wrapf(define.ErrNoSuchNetwork, "container tried to set network aliases for network %s but is not connected to the network", net) + } + } + return nil } |