Docker Community Forums

Share and learn in the Docker community.

Swarm context,Error: No such network: my_network

I am new to Docker Swarm,it seems that I do not understand concepts.This is the image in normal context

docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
someprefix/accountservice latest 1aedce37d586 22 hours ago 13MB

docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
dev - virtualbox Stopped Unknown
swarm-manager-1 - virtualbox Running tcp://192.168.99.103:2376 v18.09.5

When I try

docker service create --name=accountservice --replicas=1 --network=my_network -p=6767:6767 someprefix/accountservice
Error: No such network: my_network

If I switch to swarm context

eval $(docker-machine env swarm-manager-1)
Then
docker service create --name=accountservice2 --replicas=1 --network=my_network -p=6769:6767 someprefix/accountservice
image someprefix/accountservice:latest could not be accessed on a registry to record

I chehcked

docker images
REPOSITORY TAG IMAGE ID CREATED SIZE

How to create my service?