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

Cannot connect to more than one network #24

Closed
oskardotglobal opened this issue Jun 28, 2024 · 4 comments
Closed

Cannot connect to more than one network #24

oskardotglobal opened this issue Jun 28, 2024 · 4 comments
Labels
docker Docker-specific documentation Improvements or additions to documentation

Comments

@oskardotglobal
Copy link

In a docker run command you cannot specify multiple networks: https://stackoverflow.com/questions/60301221/docker-container-cannot-be-connected-to-network-endpoints

However, when specifying multiple networks with compose2nix, the --network flag is appended twice, which leads to the container not starting.

@aksiksi aksiksi added the bug Something isn't working label Jun 28, 2024
@aksiksi aksiksi changed the title Bug: cannot connect to more than one network Cannot connect to more than one network Jun 28, 2024
@aksiksi aksiksi added the docker Docker-specific label Jun 28, 2024
@aksiksi
Copy link
Owner

aksiksi commented Jun 28, 2024

Thanks for reporting. Can you share the output of docker version?

@aksiksi aksiksi removed the bug Something isn't working label Jun 28, 2024
@aksiksi
Copy link
Owner

aksiksi commented Jun 29, 2024

Because according to moby/moby#35543, multiple networks are supported as of Docker v25.0.0.

You can override the Docker version using the package option (set it to pkgs.docker_25): https://search.nixos.org/options?channel=24.05&show=virtualisation.docker.package&from=0&size=50&sort=relevance&type=packages&query=++++virtualisation.docker.package

@oskardotglobal
Copy link
Author

Yup, this is on Docker v24.0.9. Maybe mention this in the readme somewhere?

@aksiksi aksiksi added the documentation Improvements or additions to documentation label Jun 29, 2024
@aksiksi
Copy link
Owner

aksiksi commented Jun 29, 2024

Actually, the Docker fix I referenced above might not be working... I think I hit the same error when trying to update the integration test to use multiple networks with docker_25.

There might be a way to fix this: add a PostStart hook that runs docker network connect ... for the additional networks. This can be achieved using systemd PostStart, but the tricky part is how to keep the container stopped until the container is connected to all networks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker Docker-specific documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants