How do I set hostname in docker-compose?

后端 未结 8 2254
清酒与你
清酒与你 2020-11-29 18:11

In my docker-compose.yml file, I have the following. However the container does not pick up the hostname value. Any ideas?

dns:
  image: phensle         


        
8条回答
  •  误落风尘
    2020-11-29 18:36

    For docker compose version: "3.4"

    It works for me:

    services:
        my-service:
            hostname: my_host_name
    

    Don't need to use dns. Just use hostname. Compose file version 3 reference

提交回复
热议问题