Brother of docker-compose. Handles only Network Namespaces
- Creating and removing network namespaces
- Support for Veth pairs
- Support for Bridges and other devices
- Adding routing entries to devices, with nexthop
- Support for default gateway
- Shell using a particular namespace
This project works in Linux. Make sure you have the following dependencies installed:
- golang
- iproute2
- make
In the project folder, run:
make && sudo make install
The executable net-compose
will be installed in /usr/bin
.
See sample configs in the test
folder
Create a config file following the format in the given examples.
(Let's say its name is compose.yaml
)
To see what commands will be run to create the namespace, run:
net-compose compose.yaml dry-run
Currently the up
command is defunct. :sweat-smile:
To really create the network, for now, you can do:
net-compose compose.yaml dry-run | sudo sh -
For now, anything created on the default namespace stays. The cleanup operation deletes all the namespace.
To see the commands that will be used to delete the network, run:
net-compose compose.yaml down
To execute these commands, run:
net-compose compose.yaml down | sudo sh -
To open a shell where you can execute commands from a particular namespace, run:
sudo net-compose compose.yaml shell <name-of-the-namespace>
The namespace should be present in compose.yaml
and the network must be established beforehand.
To exit from the shell, enter the exit
command or press Ctrl+C
.