How to define build-args in docker-compose?

后端 未结 3 558
情书的邮戳
情书的邮戳 2020-12-29 03:30

I have the following docker-compose file

version: \'3\'
services:
    node1:
            build: node1
            image: node1
            container_name: n         


        
3条回答
  •  失恋的感觉
    2020-12-29 03:51

    In your dockerfile:

    ARG CERTBOT_TAG=latest
    FROM certbot/certbot:${CERTBOT_TAG}
    

    In your docker-compose.yml:

    version: '3'
    services:
      certbot-dns-namecheap:
        build:
           context: .
           args:                                                                     
             - CERTBOT_TAG=v0.40.1
    

    And you can use @lvthillo solution with '--build-arg'

提交回复
热议问题