title: Docker compose set container name for stacks
body: <p>I am deploying a small stack onto a <a href="https://docs.docker.com/datacenter/ucp/1.1/" rel="noreferrer">UCP</a></p>
  
  <p>One of the issues I am facing is naming the container for <em>service1</em>.</p>
  
  <p>I need to have a static name for the container, since it's utilized by <em>mycustomimageforservice2</em></p>
  
  <p>The <a href="https://docs.docker.com/compose/compose-file/" rel="noreferrer">container_name option</a> <em>is ignored when deploying a stack in swarm mode with a (version 3) Compose file.</em></p>
  
  <p>I have to use <strong>version: 3</strong> compose files.</p>
  
  <pre><code>version: "3"
  services:
  
    service1:
      image: dockerhub/service1
      ports: 
        - "8080:8080"
      container_name: service1container
      networks:
        - mynet
  
    service2:
      image: myrepo/mycustomimageforservice2
      networks:
        - mynet
      restart: on-failure
  
  networks:
    mynet:
  </code></pre>
  
  <p>What are my options?</p>