Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

networkCreate failing to create overlay networks #368

@vikstrous

Description

@vikstrous

Repro:

    docker, err := client.NewClient("unix:///var/run/docker.sock", "v1.24", nil, nil)
    handleErr(err)

    res, err := docker.ServerVersion(context.Background())
    handleErr(err)

    _, err = docker.NetworkCreate(context.Background(), "zzzzzzzzzz", types.NetworkCreate{
        CheckDuplicate: true,
        Driver:         "overlay",
        EnableIPv6:     false,
    })
    handleErr(err)

Error:

{"message":"rpc error: code = 3 desc = driver name: if driver is specified name is required"

engine-api posts the following data:

{
  "CheckDuplicate": true,
  "Driver": "overlay",
  "EnableIPv6": false,
  "IPAM": {
    "Driver": "",
    "Options": null,
    "Config": null
  },
  "Internal": false,
  "Options": null,
  "Labels": null,
  "Name": "zzzzzzzzzz"
}

The Docker cli uses the following data to create the request:

{
  "CheckDuplicate": true,
  "Driver": "overlay",
  "EnableIPv6": false,
  "IPAM": {
    "Driver": "default",
    "Config": [],
    "Options": {}
  },
  "Internal": false,
  "Options": {}
  "Labels": {},
  "Name": "zzzzzzzzzz",
}

Workaround:

Set the following field in the NetworkCreate struct:

IPAM:           network.IPAM{Driver: "default"}

This could probably be blamed on docker for not accepting empty string as the IPAM driver, so I'll open an issue there too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions