Munish Dhiman
Munish Dhiman

Reputation: 541

Docker swarm mode create service with --mount

I am trying to create a service in docker with following command.

    docker service create --name nginx-proxy --network my-net --replicas=1 -p 8088:80 -p 8043:443 --mount type=bind,src=/opt/my/nginx,dst=/etc/nginx/conf.d,readonly=true --constraint 'node.labels.nginx == yes' nginx 

I am getting following error:

7p5u1p5d25rd7poy3qd3szzp0   \_ docu-proxy.1  nginx  docker-swarm-0  Shutdown       Failed 6 seconds ago    "task: non-zero exit (1)"

I suspect it is because of --mount option I am using into the command. Is anything wrong with this command.

Upvotes: 2

Views: 735

Answers (1)

Munish Dhiman
Munish Dhiman

Reputation: 541

To run Nginx docker container as a service in swarm mode one should ensure that all the services, used into the nginx as a upstream server, are running otherwise service discovery would get fail and your nginx service would also get failed.

Upvotes: 1

Related Questions