-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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 compose fails to start service that use option network_mode: service. Cannot join network of a non running container #6329
Comments
Hi @abilous-ti Is there any reason you've set up your networking in such a way? Using a user-defined network would generally make for a more robust architecture, getting rid of the issue you're seeing and significantly simplifying your setup. |
Hi @shin- |
I had same issues as @abilous-ti ,hope you to find out the answer |
STOPGAP MEASUREI have this same issue! I found a stopgap measure until this issue is resolved. You can add a HEALTHCHECK to monitor whether or not I did not test with Example: version: '3'
services:
service3:
container_name: service3
image: service3/image
ports:
- 9000:9000
service2:
container_name: service2
depends_on:
- service3
healthcheck:
# put some type of test below to verify if this container is healthy or not by trying to access something in service3 that should be running
test: ["CMD", "curl", "-f", "http://localhost:9000"]
interval: 1m30s
timeout: 2s
retries: 1
autoheal:
restart: always
image: willfarrell/autoheal
environment:
- AUTOHEAL_CONTAINER_LABEL=all
volumes:
- /var/run/docker.sock:/var/run/docker.sock Some references:Restarting an unhealthy container: https://stackoverflow.com/questions/47088261/restarting-an-unhealthy-docker-container-based-on-healthcheck |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it had not recent activity during the stale period. |
I'm having a similar issue. I use a wireguard container to connect to a VPS, and rely on Edit: Weirdly it seems that setting the wireguard container to restart:always instead of unless-stopped seems to fix the traefik container starting back up correctly after reboot. Before I had wireguard as unless-stopped and traefik as restart:always. I rebooted several times and it seems to work fine now unless I'm just getting lucky - every time I set wireguard back to unless-stopped, the wireguard container successfully starts after reboot but the restart:always traefik remains down. |
I still have this issue as well using a similar setup, where my |
Description of the issue
Currently I have a single docker-compose.yml file which contains 3 services, two services depends on 3rd service
"depends_on": ["service3"],
"network_mode": "service:service3",
"restart": "always"
If I restart the OS, sometimes 1st and 2nd services do not start and s status of the containers is
Exited (255)
docker inspect command show error:
"ExitCode": 255,
"Error": "cannot join network of a non running container: cd8b33ccf2a0cc7b84d06302d641676a05f7a2fbba2cf72f77a8d339e29fd76f",
Context information (for bug reports)
Output of
docker-compose version
Output of
docker version
Output of
docker-compose config
(Make sure to add the relevant
-f
and other flags)Steps to reproduce the issue
Observed result
service1 and service2 failed to start
"ExitCode": 255,
"Error": "cannot join network of a non running container: cd8b33ccf2a0cc7b84d06302d641676a05f7a2fbba2cf72f77a8d339e29fd76f",
Expected result
service1 and service2 must be running after reboot and must be started after service3
Stacktrace / full error message
Additional information
OS version - Ubuntu 16.04
The text was updated successfully, but these errors were encountered: