Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: pass IPAM options at docker run #2066

Open
greenpau opened this issue Jan 29, 2018 · 3 comments
Open

feature: pass IPAM options at docker run #2066

greenpau opened this issue Jan 29, 2018 · 3 comments

Comments

@greenpau
Copy link

Currently, when a user creates a network, the user can pass IPAM options via --ipam-opt.

However, when a user creates a container, the user cannot pass IPAM options.

docker run --help | grep ipam

In conventional/traditional networking, e.g. DHCP, a request might contain the following options.

I suggest adding the ability to pass IPAM options at docker run and make sure that the options are passed all the way to /IpamDriver.RequestAddress endpoint. This way IPAM plugin would be capable of passing a lot more information to remote IPAM servers for the servers to make IP address management decisions.

For example, --ipam-opt vnid=<id> would allow IPAM driver to notify that the IP address request have VXLAN identifier associated with it. The IPAM servers would then use that information for routing purposes.

@abhi
Copy link
Contributor

abhi commented Jan 29, 2018

@greenpau we have this PR docker/cli#317 open few months back. We can try to put it on the fast track.

@greenpau
Copy link
Author

@greenpau we have this PR docker/cli#317 open few months back. We can try to put it on the fast track.

@abhi , that would be nice 👍

@greenpau
Copy link
Author

greenpau commented Jan 29, 2018

@abhi , the interesting thing is in docker/libnetwork/ipams/remote/remote.go the options are being passed to the function and ultimately to a remote plugin 😄 need docker/cli plumbing 😄

// RequestAddress requests an address from the address pool
func (a *allocator) RequestAddress(poolID string, address net.IP, options map[string]string) (*net.IPNet, map[string]string, error) {
    var (
        prefAddress string
        retAddress  *net.IPNet
        err         error
    )
    if address != nil {
        prefAddress = address.String()
    }
    req := &api.RequestAddressRequest{PoolID: poolID, Address: prefAddress, Options: options}
    res := &api.RequestAddressResponse{}
    if err := a.call("RequestAddress", req, res); err != nil {
        return nil, nil, err
    }
    if res.Address != "" {
        retAddress, err = types.ParseCIDR(res.Address)
    } else {
        return nil, nil, ipamapi.ErrNoIPReturned
    }
    return retAddress, res.Data, err
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants