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

WEAVE_CIDR ignored: How do I assign an IP to a container at `docker run`? #2420

Closed
hesco opened this issue Jul 4, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@hesco
Copy link

commented Jul 4, 2016

With the 1.6.0 release I no longer seem able to access the documentation which led to how I am doing things now.

I am launching weave like so: $WEAVE launch --ipalloc-range $WEAVE_SEGMENT --ipalloc-default-subnet $IPAM_SEGMENT $PEERS How do I now assign a predetermined static address to a container? I've tried including on the docker run cli, both 'IP="--ip $NFS_IP"' but also this: 'IP="-e WEAVE_CIDR=net:${NFS_IP}/24"', where I then interpolate $IP into the docker run invocation. former gives me: flag provided but not defined: --ip ; latter lets ipam provide a lease.

This is what it looks like when I run my build.sh script:

+ docker run -d -e WEAVE_CIDR=net:10.0.1.25/24 \
--net ymdweave --dns 172.17.0.1 \
--dns-search=weave.local. \
--dns-search=zone1.weave.local \
--dns-search=yourmessagedelivered.com \
--name=nfs.yourmessagedelivered.com \
-h nfs \
--memory=8gb \
--restart=always \
-v /data/var/log/nfs.yourmessagedelivered.com/daemon.log:/var/log/daemon.log \
-v /data/etc/nfs.yourmessagedelivered.com/exports:/etc/exports \
nfsv4

b116bff1ec6ac52aefadf2d16fc57a135fa7980b2d8f882d4ee3838ddfcb3652

+ /root/docker-helper-scripts/lib/sh/ip.sh -c nfs.yourmessagedelivered.com -w
10.0.0.1

That address was apparently assigned by IPAM, and not by my WEAVE_CIDR declaration.

@hesco hesco changed the title How do I assign an IP to a container at `docker run`? WEAVE_CIDR ignored: How do I assign an IP to a container at `docker run`? Jul 4, 2016

@bboreham

This comment has been minimized.

Copy link
Member

commented Jul 4, 2016

The WEAVE_CIDR environment variable is only used with the proxy; Docker do not pass environment variables through to the plugin.

However, so long as you specify a subnet for your network, you can use --ip. There is an example of the commands at the top of #2046; I couldn't quickly find it in the docs either.

General plugin docs are at https://www.weave.works/docs/net/latest/plugin/

@hesco

This comment has been minimized.

Copy link
Author

commented Jul 4, 2016

Thanks @bboreham but this is what I get:

+ docker run -d --net ymdweave --ip 10.0.1.25 --dns 172.17.0.1 --dns-search=weave.local. --dns-search=zone1.weave.local --dns-search=yourmessagedelivered.com --name=nfs.yourmessagedelivered.com -h nfs --memory=8gb --restart=always -v /data/var/log/nfs.yourmessagedelivered.com/daemon.log:/var/log/daemon.log -v /data/etc/nfs.yourmessagedelivered.com/exports:/etc/exports nfsv4

flag provided but not defined: --ip

so I recreated the network like so:

docker network create --driver weavemesh --subnet 10.0.1.0/24 ymdweave

but still get:

flag provided but not defined: --ip
@bboreham

This comment has been minimized.

Copy link
Member

commented Jul 4, 2016

Ah yes, --ip came in with Docker 1.10; I'd guess you're still using 1.9

@hesco

This comment has been minimized.

Copy link
Author

commented Jul 4, 2016

ok, looking to upgrade then. Thanks for clarifying that.

@rade rade added this to the n/a milestone Jul 20, 2016

@rade rade closed this Jul 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.