How a local container uses a swarm network?

how a local container uses a swarm network ?

i have this error:

docker: Error response from daemon: Could not attach to network my-s: rpc error: code = 7 desc = network my-s not manually attachable.

my-s is my overlay searm network

By default an overlay network created for a docker SWARM cluster can not be used by non-SWARM container.
You can create a network prior to creating the service using the --attachable flag, which allows non-SWARM container to connect.
docker network create -d overlay --attachable mynet

Within the docker-compose file you then reuse this network and set external: true.

1 Like