Docker swarm: 'build' configuration in docker compose file ignored during stack deployment : <p>We have created a docker compose file with multiple services. The images for these services are built in runtime using 'build' configuration option. The corresponding Dockerfile(s) are given in the respective directories.</p>

<p>Sample docker compose file...</p>

<pre><code>version: '3'
services:
  db2server:
    build: ./db2server
    ports:
      - "50005:50000"
    command: ["db2start"]
  appruntime:
    build: ./appruntime
    depends_on:
     - db2server
</code></pre>

<p>This docker compose file works with <code>docker-compose</code> command.</p>

<ul>
<li>The images are built in runtime from the Dockerfile(s) present in <code>db2server</code> &amp; <code>appruntime</code> directories</li>
<li>These images get deployed in the host machine</li>
</ul>

<p>But when we try to deploy this in a docker swarm, the following error is thrown...</p>

<blockquote>
  <p>docker stack deploy -c /home/docker/docker-compose.yml app</p>
</blockquote>

<pre><code>Ignoring unsupported options: build

Creating network app_default
Creating service app_db2server
failed to create service app_db2server: Error response from daemon: rpc error: code = InvalidArgument desc = ContainerSpec: image reference must be provided
</code></pre>

<p>Looks like the 'build' configuration option is ignored during stack deployment in docker swarm.</p>

<p>How can we deploy these services (with build option) defined in docker compose file in a docker swarm.</p>
