Docker Community Forums

Share and learn in the Docker community.

How to create a network in rootless Docker?

For root Docker there’s a good amount of information about the different network types and how to create them, but for rootless Docker there doesn’t seem to be any information so I’ve no idea what types of network are available (relative to root Docker) and how to create them.

Ideally I’d like to have an equivalent of a macvlan but from what I’ve read about how it works that might not be possible? I’m running a container for each VLAN (connect to the host by a trunk) so I do need something akin to macvlan functionality to bind the same port to different IPs.

Any help would be greatly appreciated.

If you want to add a container to a network after the container is already running, use the docker network connect subcommand. You can connect multiple containers to the same network. Once connected, the containers can communicate using only another container’s IP address or name.

The issue is creating the rootless network in the first place. It says rootless Docker uses slirp4netns but no information is given on how to assign different IPs to containers and ensure the containers can’t contact each other.