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

Networks > External Network has no effect #594

Open
2 tasks done
imjustleaving opened this issue Aug 19, 2024 · 4 comments
Open
2 tasks done

Networks > External Network has no effect #594

imjustleaving opened this issue Aug 19, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@imjustleaving
Copy link

⚠️ Please verify that this bug has NOT been reported before.

  • I checked and didn't find similar issue

🛡️ Security Policy

Description

I am trying to replicate the Join Networks feature in Portainer by using the sliders in the External Network section when I deploy or edit a container.

👟 Reproduction steps

  1. create a docker network (docker network create testnet)
  2. add a container (for this use-case i used prowlarr)
  3. move the slider under External Networks to "testnet"
  4. deploy
  5. verify container is on network (docker network inspect testnet)
  6. "Containers": {}, line is empty confirming no container exist on the network testnet

👀 Expected behavior

the Containers: {} line should have the info for the containers I selected to join the testnet network, in this case, prowlarr

😓 Actual Behavior

Containers: {} line remained empty.

Dockge Version

1.4.2

💻 Operating System and Arch

Ubuntu 24.04

🌐 Browser

Firerfox 129.0

🐋 Docker Version

Docker 26

🟩 NodeJS Version

No response

📝 Relevant log output

No response

@imjustleaving imjustleaving added the bug Something isn't working label Aug 19, 2024
@Persil090
Copy link

yup same issue here

@clupss
Copy link

clupss commented Sep 24, 2024

Hi, I thought this was a bug also, but it's not.
You're specifying the network in the compose file with the "External networks" slider.
You still need to tell the container to use the network also.
image
This screenshot shows that the slider adds the network to the compose file, but you still need to add it in the container config in the compose file.

You can do that by typing it manually:
image
Or you can do it by editing the container settings in dockge:
image
(At the bottom, whole screenshot added for context).

@tabula-raza
Copy link

tabula-raza commented Sep 24, 2024

thanks @clupss - I had this same issue and your explanation helped (I somehow missed that 'edit' button for each container...)

Some of my confusion stems from the docker compose documentation for using pre-existing networks which says that if an external network is defined in the top-level network element , compose will look for it and attach containers to it if it exists (instead of creating a network).

Implied by the language and example are: 1) if no other networks are specified in the network top level element, and 2) if no networks are specified in the service top-level element, then 3) the network defined in the network top level element will be treated as the default network, and containers will be attached to it.

Screenshot 2024-09-24 at 1 06 26 PM

It might be documented somewhere else but it seems that the following rules apply: 1) unless a network is specified in the service element, the container will join a default network, and 2) the default network will always be a container specific bridge network unless the default is explicitly defined in the network top-level element.

Which leads me to the following feature request: 1) a toggle in the network block of the compose editor to designate a network that you've toggled on as the default network (which would adjust the formatting of that network element appropriately), e.g. from:

networks:
    networkname:
        external: true

to:

networks:
    default:
        name: networkname
        external: true

@brianmiller
Copy link

thanks @clupss - I had this same issue and your explanation helped (I somehow missed that 'edit' button for each container...)

Some of my confusion stems from the docker compose documentation for using pre-existing networks which says that if an external network is defined in the top-level network element , compose will look for it and attach containers to it if it exists (instead of creating a network).

Implied by the language and example are: 1) if no other networks are specified in the network top level element, and 2) if no networks are specified in the service top-level element, then 3) the network defined in the network top level element will be treated as the default network, and containers will be attached to it.

Screenshot 2024-09-24 at 1 06 26 PM It might be documented somewhere else but it seems that the following rules apply: 1) unless a network is specified in the service element, the container will join a default network, and 2) the default network will always be a container specific bridge network unless the default is explicitly defined in the network top-level element.

Which leads me to the following feature request: 1) a toggle in the network block of the compose editor to designate a network that you've toggled on as the default network (which would adjust the formatting of that network element appropriately), e.g. from:

networks:
    networkname:
        external: true

to:

networks:
    default:
        name: networkname
        external: true

This worked for me. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants