Docker swarm: 'build' configuration in docker compose file ignored during stack deployment

后端 未结 3 976
我在风中等你
我在风中等你 2021-02-02 11:02

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 Dockerfi

3条回答
  •  一个人的身影
    2021-02-02 11:37

    Short answer is, you can not use the build command with docker stack deploy.

    From the docs:

    Note: The docker stack command build option is ignored when deploying a stack in swarm mode with a (version 3) Compose file. The docker stack command accepts only pre-built images.

    An alternative is to build the docker image before deploying the your swarm cluster.

    Use the docker build command to create the docker image; Push the created image to a (public or private) docker registry; and reference it in your docker compose file.

提交回复
热议问题