-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Docker Swarm error: Service cannot be explicitly attached to the ingress network "ingress" #36
Comments
Hello, The network you create probably is not for Docker Swarm. I checked the documentation and notice the procedure to create the network was wrong. I fixed here The correct way to create a network for Docker Swarm is:
Let me know if it worked. |
I tried several ways to reproduce this error and the way I could reproduce it was attaching easyhaproxy to the default e.g.: version: "3"
services:
haproxy:
image: byjg/easy-haproxy
environment:
EASYHAPROXY_DISCOVER: swarm
EASYHAPROXY_SSL_MODE: "loose"
HAPROXY_CUSTOMERRORS: "true"
HAPROXY_USERNAME: admin
HAPROXY_PASSWORD: password
HAPROXY_STATS_PORT: 1936
ports:
- "80:80/tcp"
- "443:443/tcp"
- "1936:1936/tcp"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
replicas: 1
networks:
- ingress
networks:
ingress:
external: true And when I try to run:
For some reason the My suggestion is remove completely the network from easyhaproxy: version: "3"
services:
haproxy:
image: byjg/easy-haproxy
environment:
EASYHAPROXY_DISCOVER: swarm
EASYHAPROXY_SSL_MODE: "loose"
HAPROXY_CUSTOMERRORS: "true"
HAPROXY_USERNAME: admin
HAPROXY_PASSWORD: password
HAPROXY_STATS_PORT: 1936
ports:
- "80:80/tcp"
- "443:443/tcp"
- "1936:1936/tcp"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
replicas: 1 It should allow swarm create the proper network for this stack. It is important to note that is NOT REQUIRED you create a different network for EasyHaProxy. It is able to handle automatically. |
Thanks for the advice. Tried it without a network and same error popped up. I tried a different approach and stopped other stacks before starting easyhaproxy. These stacks had no labels. And it worked. haproxy came up properly*. After some more testing, it seems that I need to start haproxy first before other stacks (but services seem to be fine). And if I want to update haproxy settings, I need to stop other stacks, restart haproxy stack and then start the other ones. Another problems seems to be that I am getting the same error about ingress network, when trying to add some haproxy labels to stacks. Needless to say that proxing doesn't work. Any ideas where to investigate further? *Its default network attached itself to another docker service running (Portainer Agent). Not sure if that is good or bad. |
I might found the issue. In all tests I did, only EasyHAProxy had the ports exposed. If you also exposing the ports of the other services It might be causing the issue. Since EasyHAProxy is the ingress, you don't need expose the ports of services. However, digging here, I changed the way to add the network and it can fix the issue in this particular case scenario. I opened the PR #37 to track this issue. Could you test with the version |
Great, thanks, tried it. It seems that it is starting now. However, in my configuration below it seems to have removed the odoo-test network from services. Only version: '3.3'
services:
db:
image: postgres:13
command:
- postgres
- -c
- max_connections=200
environment:
PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_DB: test
POSTGRES_PASSWORD_FILE: /run/secrets/odoo_erp_test_db_password
ports:
- 5432
networks:
- odoo-test
volumes:
- odoo-test-db-data:/var/lib/postgresql/data/pgdata
secrets:
- odoo_erp_test_db_password
web:
image: odoo/odoo:v14
deploy:
replicas: 1
labels:
easyhaproxy.frontend.host: test.domain.de
easyhaproxy.frontend.port: 443
easyhaproxy.frontend.sslcert: /run/secrets/erp-test-cloudflare-certs-base64
easyhaproxy.frontend.ssl: "true"
easyhaproxy.frontend.localport: 8069
command:
- --max-cron-threads=1
environment:
PASSWORD_FILE: /run/secrets/odoo_erp_test_db_password
USER: odoo
ports:
- 8069
- 8071
- 8072
volumes:
- odoo-test-web-data:/var/lib/odoo
networks:
- odoo-test
secrets:
- odoo_erp_test_db_password
- erp-test-cloudflare-certs-base64
networks:
odoo-test:
driver: overlay
volumes:
odoo-test-db-data:
odoo-test-web-data:
secrets:
odoo_erp_test_db_password:
external: true
erp-test-cloudflare-certs-base64:
external: true On a side note, it seems |
Now I could reproduce your issue on my side and I created a new tag What I addressed here:
Regarding your issue with the network, the only way EasyHAProxy can communicate with the other services is by putting them in the same network. One consideration with that is if we deploy the EasyHAProxy and assign a network of other services to EasyHAProxy or allow the stack to create a network, we won't be able to remove the EasyHAProxy stack because the network is attached to other services. One way to avoid this is creating the network outside the stack. docker network create -d overlay easyhaproxy And on your stack: services:
haproxy:
image: byjg/easy-haproxy:4.3.1-rc2
volumes:
- /var/run/docker.sock:/var/run/docker.sock
...
networks:
- easyhaproxy
networks:
easyhaproxy:
external: true |
Just pinging to see if your issue was solved. |
Thanks! Sorry for not getting back to you. I have moved on with Traefik for our test env. But I will check your RC and get back to you once I have time. |
When using the default yml for Docker Swarm, I am getting the following error during start:
My yml looks like this:
The text was updated successfully, but these errors were encountered: