Handle networks.driver_opts for a service

These are endpoint-specific driver options...

services:
  myservice:
    image: myimage
    networks:
      mynet:
        driver_opts:
          "option1": "value1"

The API has had support for a long time, it's only recently been
added to compose (unreleased right now).

Signed-off-by: Rob Murray <rob.murray@docker.com>
This commit is contained in:
Rob Murray
2024-06-07 09:13:21 +01:00
parent a731722652
commit 94f9de5928
8 changed files with 38 additions and 6 deletions

View File

@ -207,6 +207,9 @@ services:
aliases:
- alias1
- alias3
driver_opts:
"driveropt1": "optval1"
"driveropt2": "optval2"
other-network:
ipv4_address: 172.16.238.10
ipv6_address: 2001:3984:3989::10

View File

@ -190,6 +190,10 @@ func services(workingDir, homeDir string) []types.ServiceConfig {
Aliases: []string{"alias1", "alias3"},
Ipv4Address: "",
Ipv6Address: "",
DriverOpts: map[string]string{
"driveropt1": "optval1",
"driveropt2": "optval2",
},
},
"other-network": {
Ipv4Address: "172.16.238.10",

View File

@ -285,7 +285,11 @@
"aliases": [
"alias1",
"alias3"
]
],
"driver_opts": {
"driveropt1": "optval1",
"driveropt2": "optval2"
}
}
},
"pid": "host",

View File

@ -152,6 +152,9 @@ services:
aliases:
- alias1
- alias3
driver_opts:
driveropt1: optval1
driveropt2: optval2
pid: host
ports:
- mode: ingress