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

后端 未结 3 974
我在风中等你
我在风中等你 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:30

    If anyone is still on this you can tag the built image in compose by setting the image parameter along with the build parameter, as you can see in the build section of the docs. So the file should look like:

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

    then you can do:

    docker-compose build
    docker-compose push
    docker stack deploy -c /home/docker/docker-compose.yml app
    

提交回复
热议问题