title: Not able to run service using docker stack in docker swarm
body: <p>Here is the docker-compose file that I once used to successfully run docker container using docker-compose.</p>
  
  <p>Now trying to deploy using the docker stack. My manager and workers node are ready.</p>
  
  <p><strong>docker-compose.yml</strong></p>
  
  <pre><code>version: '3'
  services:
  
      prometheus:
          image: prom/prometheus
          volumes:
              - ./prometheus.yml:/etc/prometheus/prometheus.yml
          command:
              - '--config.file=/etc/prometheus/prometheus.yml'
          ports:
              - '9090:9090'
          deploy:
             mode: replicated
             replicas: 1
             placement:
                 constraints:
                     - node.role == manager
  </code></pre>
  
  <p><strong>Command used:</strong></p>
  
  <pre><code>docker stack deploy -c docker-compose.yml monitoring
  </code></pre>
  
  <p>Trying to run it in the manager node. Why is the service not running . checking if the service is running or not using <code>docker service ls</code> shows 0/1 as you can see in the figure bellow. </p>
  
  <p><a href="https://i.stack.imgur.com/3oCQ0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3oCQ0.png" alt="docker service ls checking"></a></p>
  
  <p>When trying to check the logs with <code>docker service logs &lt;servicename&gt;</code> Nothing gets loaded.</p>
  
  <p>Where exactly am I missing the things. My ultimate goal being running the full docker monitoring service like cadvisor and node-exporter and all other required. I tried with this <strong><a href="https://github.com/stefanprodan/swarmprom/blob/master/docker-compose.yml" rel="nofollow noreferrer">https://github.com/stefanprodan/swarmprom/blob/master/docker-compose.yml</a></strong></p>
  
  <blockquote>
    <p>I have figured out the problem is in the replicated mode, runs well in global mode although.</p>
  </blockquote>
  
  <p><strong>What error is here with the replicated mode. I don't think I  have a syntax error here. How to make it run in replicated mode and in the manager node only</strong> </p>