macvlan: --ip-range single IP address /32
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2.2k
- Forks
- 875
- PR merge metrics
- No merged PRs in 30d
Description
Creating macvlan network with single IP address range works, but attaching container fails.
Create network:
$ docker network create -d macvlan \
--subnet 192.168.34.0/24 \
-o parent=eth0 \
--ip-range 192.168.34.54/32 \
eth0-test
3b413e03b6de671c20c48cdeb07562c42a220b983d464a467a6be8492ff5eb8c
Create container:
$ docker run -it --detach=false --network eth0-test ubuntu:latest
docker: Error response from daemon: no available IPv4 addresses on this network's address pools: eth0-test (3b413e03b6de671c20c48cdeb07562c42a220b983d464a467a6be8492ff5eb8c).
Ultimate goal, to have predefined IP address assigned to container like above and further more to service, like below:
Host1:
$ docker network create --config-only \
--subnet 192.168.34.0/24 \
-o parent=eth0 \
--ip-range 192.168.34.2/32 \
eth0-net
Host2:
$ docker network create --config-only \
--subnet 192.168.34.0/24 \
-o parent=eth0 \
--ip-range 192.168.34.3/32 \
eth0-net
Host-any:
$ docker network create -d macvlan \
--scope swarm --config-from eth0-net eth0-swarm-net
$ docker service create --mode global --name test-service \
--network eth0-swarm-net ubuntu:latest sleep infinity
Such service container will acquire IP 192.168.34.2 when started on host1, and 192.168.34.3 when started on host2.
Service not necessarily should be global, it could be replicated with sticky docker host configuration, guaranteeing only one instance attaching to network eth0-swarm-net per docker host.
Thus achieving static IP address assignment on per host / container basis in swarm mode.
Docker version:
$ docker version
Client:
Version: 18.06.0-ce
API version: 1.38
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:11:02 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.0-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:09:05 2018
OS/Arch: linux/amd64
Experimental: false
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the macvlan network and container commands in the issue with the reported Docker version, then trace how the address pool handles a /32 range. Verify the behavior for both a standalone container and the described config-only Swarm networks; done means a valid single-address range can be attached without the no-available-addresses error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100