Is it possible to assign an IP address to a service using IPvlan L3?

Hey there,

I created a local ipvlan network using:
docker network create -d ipvlan --subnet 192.168.2.0/24 -o ipvlan_mode=l3 -o parent=eth0 net1

I also configured a static route.

Then I ran a container using:
docker run --net=net1 --ip=192.168.2.20 -itd nginxdemos/hello
and it is accessible on 192.168.2.20 as expected.


Now, I want to run a service with 1 replica (namely Portainer) on a fixed IP address just like the nginxdemos/hello container.
In order to do this I created another network using:
docker network create -d ipvlan --subnet 192.168.3.0/24 -o ipvlan_mode=l3 -o parent=eth0 --scope swarm --attachable net2

Then I defined the service and deployed it using docker stack deploy:

version: "3.9"

networks:
  net2:
    external: true

services:
  test:
    image: nginxdemos/hello:latest
    networks:
      net2:
        ipv4_address: 192.168.3.20
    ports:
      - target: 80
        published: 80
        protocol: tcp
        mode: host
    deploy:
      mode: replicated
      replicas: 1

But 192.168.3.20 is not reachable, even a ping times out. (Static Route is configured)

The weird thing is that the net2 inspection doesn’t include the specified subnet:
docker network inspect net2

{
        "Name": "net2",
        "Id": "adjjc0cd8qt948m6e4r8tjayy",
        "Created": "2022-08-10T15:13:21.640286553+02:00",
        "Scope": "swarm",
        "Driver": "ipvlan",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.29.0.0/16",
                    "Gateway": "172.29.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": true,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "040db29e179db6eeb1f07e816510a9423bbc7a1d383ad02fa05013f0fe34f030": {
                "Name": "t_test.1.yf8w8qvxy138upw4593xrbw47",
                "EndpointID": "9b00e45fc01bace5ce729e4f3e5dfdc344cdd81f043a19ef3d86fdefbf40648b",
                "MacAddress": "",
                "IPv4Address": "172.29.0.2/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {},
        "Peers": [
            {
                "Name": "0b4ce887717d",
                "IP": "192.168.1.114"
            }
        ]
    }

Whereas net1 does include it:

 {
        "Name": "net1",
        "Id": "0d775ddd0fe145f88c9ffd791672295cc1b25e118a451dd2fa7aa66ec1d9895e",
        "Created": "2022-08-10T15:22:03.652192726+02:00",
        "Scope": "local",
        "Driver": "ipvlan",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "192.168.2.0/24"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {
            "ipvlan_mode": "l3",
            "parent": "eth0"
        },
        "Labels": {}
    }

Edit: Docker Version

$ sudo docker version
Client: Docker Engine - Community
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:02:17 2022
 OS/Arch:           linux/arm64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:00:41 2022
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.7
  GitCommit:        0197261a30bf81f1ee8e6a4dd2dea0ef95d67ccb
 runc:
  Version:          1.1.3
  GitCommit:        v1.1.3-0-g6724737
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Does anyone know if I did something wrong or is it just not possible at the moment?
Thanks!