I am trying to create a container in a multihost network but while creating I am getting this error:
Error response from daemon: network myapp not found
Here myapp
is the name of overlay network which i have created. The command I am using is:
sudo docker run --rm -it --name=test_cont --net=myapp ubuntu bash
Docker networks are scoped for different access. Your
myapp
network is an overlay network scoped to the swarm.That means you can only use it at swarm level -
docker service create --network myapp
will work fine, because services are at swarm level too.You can start a container with
docker run
on a swarm, but it will only run locally on the node where you run the command on, so it can't see swarm networks.