-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
NetworkMode parameter uses container ID instead of name #2657
Comments
I have some more insight on this issue. When creating/recreating a container in Portainer, the NetworkMode parameter in the container's hostconfig.json file is always saved to use the container ID, instead of the name (e.g. "NetworkMode": "container:543hde09...." instead of "NetworkMode": "container:vpn"). If I manually edit the hostconfig.json file to use the name of the container instead, I can see the expected behavior the next time I attempt to edit the container in Portainer. This also solves a separate issue I was having where I wasn't able to start/restart a container that used --net=container:vpn if that 'vpn' container was recreated prior. Probably due to the fact that the container ID doesn't exist anymore So I guess the simple(?) solution to this is to make sure that the NetworkMode parameter always saves using the container name, instead of the ID. |
I'm seeing this same behavior with portainer 1.22 |
Using "container" as network name causes issues. Docker thinks its a network_mode configuration. See: https://docs.docker.com/compose/compose-file/#network_mode . It can be a bug or undocumented restriction on docker, i don't know exactly |
Just tested with 1.23.0, and I don't believe the main issue has been fixed yet. I apologize that my issue description only focused on the cosmetic problems. When editing a container immediately after creating it, the correct network container is selected in the UI by default now. However, containers are still being deployed using the ID of the network container, instead of the name. This still causes issues if the parent network container is ever recreated. For example:
|
cc @itsconquest |
Thanks for reporting this @ryester27 I have confirmed this behaviour, are you able to open a separate bug report for this? |
This bug is still not fixed - recreating a container used for networking will cause all the containers using it to lose access because the id of the recreated container has changed. |
sooo.. this one ever getting fixed? |
Bug description
In the Network tab underneath the Advanced Container Settings section of a created container, if you're using the "container" Network, the chosen Container sub-option reverts to "Select a container" when you save and view/edit the container settings again.
As far as I have seen, this is only a cosmetic issue, and the container is still properly configured to use the network of another container.
An additional issue that this causes is that when editing a container, you receive a "Failure Invalid network mode: invalid container format container:" error when trying to deploy. The error vanishes when you select the proper Container sub-option again.
Expected behavior
The chosen Network Container sub-option sticks between edits
Steps to reproduce the behavior:
Technical details:
docker run -p 9000:9000 portainer/portainer
): docker run -p 9000:9000 portainer/portainer --no-authThe text was updated successfully, but these errors were encountered: