0

I'm trying to replicate a production environment (CentOS 7) on a macbook, the environment consist basically of several docker swarm services that interact with a couple of databases. These databases are in containers attached to the same overlay network of the services, but out of the swarm.

I created the swarm and the network in the macbook

docker swarm init
docker network create --attachable --driver overlay --subnet 10.0.1.0/24 test-net

I have this compose file to run one of the databases

version: '3.8'

services:
  cassandra:
    image: cassandra:3.11.4
    networks:
      test-net:
        ipv4_address: 10.0.1.10

networks:
  test-net:
    external: true

but whenever I try to run it with docker-compose up it shows either

ERROR: for d129d5ad7ec8_cassandra-test  Cannot start service cassandra: attaching to network failed, make sure your network options are correct and check manager logs: context deadline exceeded

ERROR: for cassandra  Cannot start service cassandra: attaching to network failed, make sure your network options are correct and check manager logs: context deadline exceeded
ERROR: Encountered errors while bringing up the project.

or

ERROR: for d129d5ad7ec8_cassandra-test  Cannot start service cassandra: network test-net not found

ERROR: for cassandra  Cannot start service cassandra: network test-net not found
ERROR: Encountered errors while bringing up the project.

docker network inspect test-net seems completely normal and coherent with the production environment and I haven't found a solution that works by browsing similar issues. I also tried to run the container without the compose file with similar results. Why can't I attach this container to the overlay network?

vlizana
  • 101
  • 3
  • your configuration seems correct. I'd try changing the order of arguments passed to create the network to `docker network create --driver overlay --attachable --subnet 10.0.1.0/24 test-net` or creating the network from the compose file. – Rinaldi Segecin Sep 14 '20 at 14:53

0 Answers0