Skip to content

Commit

Permalink
networks.enable_ipv6: make it optional
Browse files Browse the repository at this point in the history
This field isn't marked as required in the compose-spec, but it's
implemented as a basic `bool` in this package. This means it
automatically defaults to `false` when not specified.

A recent change was made to Docker Engine to allow users to define a
daemon-wide default value for the equivalent API field. Without this
change, Compose would always send a value to the Engine API, preventing
it from defining its own default value.

See moby/moby#47867.

Signed-off-by: Albin Kerouanton <[email protected]>
  • Loading branch information
akerouanton authored and ndeloof committed Jun 9, 2024
1 parent 27c7848 commit 35c575c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1689,6 +1689,7 @@ networks:

workingDir, err := os.Getwd()
assert.NilError(t, err)
enableIPv6 := true
expected := &types.Project{
Name: "load-network-link-local-ips",
WorkingDir: workingDir,
Expand All @@ -1711,7 +1712,7 @@ networks:
"network1": {
Name: "network1",
Driver: "bridge",
EnableIPv6: true,
EnableIPv6: &enableIPv6,
Ipam: types.IPAMConfig{
Config: []*types.IPAMPool{
{Subnet: "10.1.0.0/16"},
Expand Down
2 changes: 1 addition & 1 deletion types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ type NetworkConfig struct {
Internal bool `yaml:"internal,omitempty" json:"internal,omitempty"`
Attachable bool `yaml:"attachable,omitempty" json:"attachable,omitempty"`
Labels Labels `yaml:"labels,omitempty" json:"labels,omitempty"`
EnableIPv6 bool `yaml:"enable_ipv6,omitempty" json:"enable_ipv6,omitempty"`
EnableIPv6 *bool `yaml:"enable_ipv6,omitempty" json:"enable_ipv6,omitempty"`
Extensions Extensions `yaml:"#extensions,inline,omitempty" json:"-"`
}

Expand Down

0 comments on commit 35c575c

Please sign in to comment.