Docker run fails to start container with error "docker: Error response from daemon: Address already in use."

Docker run command fails
Ubuntu 18.04.03 LTS
Docker version 19.03.5, build 633a0ea838

When i try to run a container with command:

docker run --name openldap --detach osixia/openldap:1.3.0 --network=development

it fails and I get the error msg:

"docker: Error response from daemon: Address already in use."

I’ve started the docker daemon in debug mode and I can’t quite make out what it struggles with but it appears to be trying to use an ip6 address that is already in use:

"DEBU[2020-04-07T13:24:18.148342457+01:00] RequestAddress(LocalDefault/fe80::/64, fe80::42:242:ac11:2, map[]) "

but i’m confused because when i try to specify the ip6 address explicitly in the run command:

docker run --name openldap --detach osixia/openldap:1.3.0 --network=development --ip6=fe80:1::2

i still get the same line in the daemon:

DEBU[2020-04-07T13:54:15.922486026+01:00] RequestAddress(LocalDefault/fe80::/64, fe80::42:242:ac11:2, map[])

0

make sure you execute the command correctly… i noticed in the daemon debug output that it was choosing the wrong network and it’s because i’ve put the image before the last parameter to the command

it should be:

docker run --name openldap --detach --network=development osixia/openldap:1.3.0

and then it runs fine