Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm searching for a way to create multiple loopbacks in my Docker Image.

On a "normal" Ubuntu I call

sudo ifconfig lo:1 10.53.0.2/16 up
sudo ifconfig lo:2 10.53.0.3/16 up
sudo ifconfig lo:3 10.53.1.1/16 up
sudo ifconfig lo:4 10.53.1.2/16 up

to setup my loopbacks, but Docker rejects the commands with this error message:

SIOCSIFADDR: Operation not permitted
SIOCSIFFLAGS: Operation not permitted
SIOCSIFFLAGS: Operation not permitted
SIOCSIFNETMASK: Operation not permitted

I also tried creating networks with

docker network create

but that didn't work either

I'm running Docker version 17.06.0-ce and my Base Image is Ubuntu 14.04.

Maybe someone can help?

Thanks, Chris

By default, containers run with some limitations.

When start your container, use --cap-add to be able to add sub interfaces:

docker run --cap-add NET_ADMIN
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.