Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuring custom IP address for nerdctl default bridge #3625

Open
swagatbora90 opened this issue Oct 31, 2024 · 3 comments · May be fixed by #3640
Open

Configuring custom IP address for nerdctl default bridge #3625

swagatbora90 opened this issue Oct 31, 2024 · 3 comments · May be fixed by #3640

Comments

@swagatbora90
Copy link

What is the problem you're trying to solve

I would like to set a custom subnet range for the nerdctl bridge IP which is currently set to 10.4.0.0/24. In docker, this can be done by setting the bip option in daemon config, however I could not find a similar option in nerdctl. A quick and hacky way to get around this is to manually update the bridge cni conf file to set the subnet and gateway, however I would like to discuss if this can be added as a option in nerdctl toml.

Also, unlike docker, nerdctl does not allow removing the default bridge network, so we will need some additional handling to detect the change of bridge ip (in case the option gets added after the bridge is already created), and trigger a update workflow. I have a reference implementation here here.

Is this something the community would consider to add as a new feature? If so I can go ahead and open a PR.

Describe the solution you'd like

Introduce a new option in nerdctl.toml

| `bridge_ip`         | `--bridge-ip`                       | `NERDCTL_BRIDGE_IP`      | IP address for the default nerdctl bridge network 

That configures the default 'bridge' network with the specified ip address. If the bridge network is already created, adding this new option will update the existing 'bridge' IP provided there are no running containers attached to that network.

Additional context

No response

@apostasie
Copy link
Contributor

Hey @swagatbora90

Curious about your use-case here.

Couldn't you create your own bridge network instead?

nerdctl network create mybridge --subnet 10.0.10.0/24
nerdctl network inspect mybridge

@swagatbora90
Copy link
Author

Hi @apostasie,

My usecase is using finch with nerdctl. finch relies on the default bridge network that nerdctl creates. So containers launched without any network --network get attached to this default network.

Creating a new bridge network does not work, since the default network has special treatment in nerdctl which we would like to preserve, such as protection again network prune commands.

@apostasie
Copy link
Contributor

Thanks @swagatbora90
Makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants