Docker network breaks after host reboot

I have multiple LAMP stacks using php and apache and mysql. They all work great. An excerpt from the docker-compose.yml looks like the following:

services:
apache24-php74:
build: ./apache-php74
container_name: apache24php74
restart: unless-stopped
networks:

  • tikia-app-network # Assign to the network

networks: #Define the shared network
tikia-app-network:
driver: bridge

When I reboot the host machine daily, I do a “docker network inspect tikia-app-network the endpoint id’s are different. I know containers should be using service name discovery but they still cannot see each other. I have to create a new network after each reboot. I don’t want to do that why wont it just work

Containers are for isolation. By default, Docker compose creates Docker networks per compose project. They are by default prefixed with the current project name, see docker network ls.

Usually you would create a network in one project with attachable: true and name:, and in other projects use external: true, to make it available to all projects, like proxy and services.

Or you manually create a Docker network and use in all compose files external: true.

I don’t understand the issue. What is happening exactly? You say it doesn’t work after reboot, but what is not working? What is the error message?

@bluepuma77 shared his thoughts about what might help you. Please, reply to that post too and share if you think it is not relevant i your case and why you think that. Every time I read that post again, I feel more that it is what your problem could be.

And please, sue code blocks so we can undrstand your shared code snippets.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.