How Do I Set Hostname in Docker Compose?











up vote
51
down vote

favorite
12












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



dns:
image: phensley/docker-dns
hostname: affy
domainname: affy.com
volumes:
- /var/run/docker.sock:/docker.sock









share|improve this question




















  • 2




    I have edited your question to correctly display preformatted text. This makes it much more readable.
    – larsks
    Apr 28 '15 at 17:02






  • 1




    What version of Compose are you using?
    – kojiro
    Apr 28 '15 at 17:51















up vote
51
down vote

favorite
12












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



dns:
image: phensley/docker-dns
hostname: affy
domainname: affy.com
volumes:
- /var/run/docker.sock:/docker.sock









share|improve this question




















  • 2




    I have edited your question to correctly display preformatted text. This makes it much more readable.
    – larsks
    Apr 28 '15 at 17:02






  • 1




    What version of Compose are you using?
    – kojiro
    Apr 28 '15 at 17:51













up vote
51
down vote

favorite
12









up vote
51
down vote

favorite
12






12





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



dns:
image: phensley/docker-dns
hostname: affy
domainname: affy.com
volumes:
- /var/run/docker.sock:/docker.sock









share|improve this question















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



dns:
image: phensley/docker-dns
hostname: affy
domainname: affy.com
volumes:
- /var/run/docker.sock:/docker.sock






docker docker-compose






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 16 at 17:12









Wilfred Hughes

16.4k1091128




16.4k1091128










asked Apr 28 '15 at 16:25









David Medinets

2,53321716




2,53321716








  • 2




    I have edited your question to correctly display preformatted text. This makes it much more readable.
    – larsks
    Apr 28 '15 at 17:02






  • 1




    What version of Compose are you using?
    – kojiro
    Apr 28 '15 at 17:51














  • 2




    I have edited your question to correctly display preformatted text. This makes it much more readable.
    – larsks
    Apr 28 '15 at 17:02






  • 1




    What version of Compose are you using?
    – kojiro
    Apr 28 '15 at 17:51








2




2




I have edited your question to correctly display preformatted text. This makes it much more readable.
– larsks
Apr 28 '15 at 17:02




I have edited your question to correctly display preformatted text. This makes it much more readable.
– larsks
Apr 28 '15 at 17:02




1




1




What version of Compose are you using?
– kojiro
Apr 28 '15 at 17:51




What version of Compose are you using?
– kojiro
Apr 28 '15 at 17:51












4 Answers
4






active

oldest

votes

















up vote
8
down vote



accepted










I found that the hostname was not visible to other containers when using docker run. This turns out to be a known issue (perhaps more a known feature), with part of the discussion being:




We should probably add a warning to the docs about using hostname. I think it is rarely useful.




The correct way of assigning a hostname - in terms of container networking - is to define an alias like so:



services:
some-service:
networks:
some-network:
aliases:
- alias1
- alias2


Unfortunately this still doesn't work with docker run. The workaround is to assign the container a name:



docker-compose run --name alias1 some-service


And alias1 can then be pinged from the other containers.






share|improve this answer

















  • 1




    I'm stuck with that problem that I can't access container by hosname from other containers. And you're the only one in whole internet who stated this problem.. been googling for 20 hours already
    – holms
    Apr 9 at 3:47


















up vote
31
down vote













This seems to work correctly. If I put your config into a file:



$ cat > compose.yml <<EOF
dns:
image: phensley/docker-dns
hostname: affy
domainname: affy.com
volumes:
- /var/run/docker.sock:/docker.sock
EOF


And then bring things up:



$ docker-compose -f compose.yml up
Creating tmp_dns_1...
Attaching to tmp_dns_1
dns_1 | 2015-04-28T17:47:45.423387 [dockerdns] table.add tmp_dns_1.docker -> 172.17.0.5


And then check the hostname inside the container, everything seems to be fine:



$ docker exec -it stack_dns_1 hostname
affy.affy.com





share|improve this answer





















  • What version of Compose are you using?
    – kojiro
    Apr 28 '15 at 17:52










  • This format doesn't work in the latest version of docker-compose. YML files are finicky things; are you sure this is the right format for dns?
    – George Stocker
    Nov 24 '15 at 3:08






  • 2




    YML files aren't really all that finicky. What does "doesn't work" mean? According to the docs, both hostname and domainname are valid docker-compose.yml options. Update: just tested, still seems to work just fine (docker-compose version 1.4.2, docker version 1.8.2).
    – larsks
    Nov 24 '15 at 12:45












  • Is there any way to expose this hostname outside of the docker environment? It would be nice if the host could access the docker containers by their dns name.
    – Paul Praet
    Apr 6 '16 at 8:21










  • That is possible, and probably worth it's own question. If you search for "docker dns" you will find several relevant results; take a look at what's out there first.
    – larsks
    Apr 6 '16 at 11:27


















up vote
16
down vote













Based on docker documentation:
https://docs.docker.com/compose/compose-file/#/command



I simply put
hostname: <string>
in my docker-compose file.



E.g.:



[...]

lb01:
hostname: at-lb01
image: at-client-base:v1

[...]


and container lb01 picks up at-lb01 as hostname.






share|improve this answer























  • if you have multiple containers in the docker-compose file, would you set the hostname for each container? that seems very inefficient?
    – vgoklani
    Sep 19 '17 at 10:13






  • 1




    If you need well-known names for containers that's a viable solution.
    – Marcello Romani
    Oct 2 '17 at 11:48


















up vote
2
down vote













I needed to spin freeipa container to have a working kdc and had to give it a hostname otherwise it wouldn't run.
What eventually did work for me is setting the HOSTNAME env variable in compose:



version: 2
services:
freeipa:
environment:
- HOSTNAME=ipa.example.test


Now its working:



docker exec -it freeipa_freeipa_1 hostname
ipa.example.test





share|improve this answer

















  • 1




    For me, using slim, that results in a HOSTNAME environment variable that has no effect at all on the actual hostname of the container
    – Oliver Dungey
    Oct 18 at 13:52











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f29924843%2fhow-do-i-set-hostname-in-docker-compose%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























4 Answers
4






active

oldest

votes








4 Answers
4






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
8
down vote



accepted










I found that the hostname was not visible to other containers when using docker run. This turns out to be a known issue (perhaps more a known feature), with part of the discussion being:




We should probably add a warning to the docs about using hostname. I think it is rarely useful.




The correct way of assigning a hostname - in terms of container networking - is to define an alias like so:



services:
some-service:
networks:
some-network:
aliases:
- alias1
- alias2


Unfortunately this still doesn't work with docker run. The workaround is to assign the container a name:



docker-compose run --name alias1 some-service


And alias1 can then be pinged from the other containers.






share|improve this answer

















  • 1




    I'm stuck with that problem that I can't access container by hosname from other containers. And you're the only one in whole internet who stated this problem.. been googling for 20 hours already
    – holms
    Apr 9 at 3:47















up vote
8
down vote



accepted










I found that the hostname was not visible to other containers when using docker run. This turns out to be a known issue (perhaps more a known feature), with part of the discussion being:




We should probably add a warning to the docs about using hostname. I think it is rarely useful.




The correct way of assigning a hostname - in terms of container networking - is to define an alias like so:



services:
some-service:
networks:
some-network:
aliases:
- alias1
- alias2


Unfortunately this still doesn't work with docker run. The workaround is to assign the container a name:



docker-compose run --name alias1 some-service


And alias1 can then be pinged from the other containers.






share|improve this answer

















  • 1




    I'm stuck with that problem that I can't access container by hosname from other containers. And you're the only one in whole internet who stated this problem.. been googling for 20 hours already
    – holms
    Apr 9 at 3:47













up vote
8
down vote



accepted







up vote
8
down vote



accepted






I found that the hostname was not visible to other containers when using docker run. This turns out to be a known issue (perhaps more a known feature), with part of the discussion being:




We should probably add a warning to the docs about using hostname. I think it is rarely useful.




The correct way of assigning a hostname - in terms of container networking - is to define an alias like so:



services:
some-service:
networks:
some-network:
aliases:
- alias1
- alias2


Unfortunately this still doesn't work with docker run. The workaround is to assign the container a name:



docker-compose run --name alias1 some-service


And alias1 can then be pinged from the other containers.






share|improve this answer












I found that the hostname was not visible to other containers when using docker run. This turns out to be a known issue (perhaps more a known feature), with part of the discussion being:




We should probably add a warning to the docs about using hostname. I think it is rarely useful.




The correct way of assigning a hostname - in terms of container networking - is to define an alias like so:



services:
some-service:
networks:
some-network:
aliases:
- alias1
- alias2


Unfortunately this still doesn't work with docker run. The workaround is to assign the container a name:



docker-compose run --name alias1 some-service


And alias1 can then be pinged from the other containers.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 '17 at 12:10









foz

1,1701314




1,1701314








  • 1




    I'm stuck with that problem that I can't access container by hosname from other containers. And you're the only one in whole internet who stated this problem.. been googling for 20 hours already
    – holms
    Apr 9 at 3:47














  • 1




    I'm stuck with that problem that I can't access container by hosname from other containers. And you're the only one in whole internet who stated this problem.. been googling for 20 hours already
    – holms
    Apr 9 at 3:47








1




1




I'm stuck with that problem that I can't access container by hosname from other containers. And you're the only one in whole internet who stated this problem.. been googling for 20 hours already
– holms
Apr 9 at 3:47




I'm stuck with that problem that I can't access container by hosname from other containers. And you're the only one in whole internet who stated this problem.. been googling for 20 hours already
– holms
Apr 9 at 3:47












up vote
31
down vote













This seems to work correctly. If I put your config into a file:



$ cat > compose.yml <<EOF
dns:
image: phensley/docker-dns
hostname: affy
domainname: affy.com
volumes:
- /var/run/docker.sock:/docker.sock
EOF


And then bring things up:



$ docker-compose -f compose.yml up
Creating tmp_dns_1...
Attaching to tmp_dns_1
dns_1 | 2015-04-28T17:47:45.423387 [dockerdns] table.add tmp_dns_1.docker -> 172.17.0.5


And then check the hostname inside the container, everything seems to be fine:



$ docker exec -it stack_dns_1 hostname
affy.affy.com





share|improve this answer





















  • What version of Compose are you using?
    – kojiro
    Apr 28 '15 at 17:52










  • This format doesn't work in the latest version of docker-compose. YML files are finicky things; are you sure this is the right format for dns?
    – George Stocker
    Nov 24 '15 at 3:08






  • 2




    YML files aren't really all that finicky. What does "doesn't work" mean? According to the docs, both hostname and domainname are valid docker-compose.yml options. Update: just tested, still seems to work just fine (docker-compose version 1.4.2, docker version 1.8.2).
    – larsks
    Nov 24 '15 at 12:45












  • Is there any way to expose this hostname outside of the docker environment? It would be nice if the host could access the docker containers by their dns name.
    – Paul Praet
    Apr 6 '16 at 8:21










  • That is possible, and probably worth it's own question. If you search for "docker dns" you will find several relevant results; take a look at what's out there first.
    – larsks
    Apr 6 '16 at 11:27















up vote
31
down vote













This seems to work correctly. If I put your config into a file:



$ cat > compose.yml <<EOF
dns:
image: phensley/docker-dns
hostname: affy
domainname: affy.com
volumes:
- /var/run/docker.sock:/docker.sock
EOF


And then bring things up:



$ docker-compose -f compose.yml up
Creating tmp_dns_1...
Attaching to tmp_dns_1
dns_1 | 2015-04-28T17:47:45.423387 [dockerdns] table.add tmp_dns_1.docker -> 172.17.0.5


And then check the hostname inside the container, everything seems to be fine:



$ docker exec -it stack_dns_1 hostname
affy.affy.com





share|improve this answer





















  • What version of Compose are you using?
    – kojiro
    Apr 28 '15 at 17:52










  • This format doesn't work in the latest version of docker-compose. YML files are finicky things; are you sure this is the right format for dns?
    – George Stocker
    Nov 24 '15 at 3:08






  • 2




    YML files aren't really all that finicky. What does "doesn't work" mean? According to the docs, both hostname and domainname are valid docker-compose.yml options. Update: just tested, still seems to work just fine (docker-compose version 1.4.2, docker version 1.8.2).
    – larsks
    Nov 24 '15 at 12:45












  • Is there any way to expose this hostname outside of the docker environment? It would be nice if the host could access the docker containers by their dns name.
    – Paul Praet
    Apr 6 '16 at 8:21










  • That is possible, and probably worth it's own question. If you search for "docker dns" you will find several relevant results; take a look at what's out there first.
    – larsks
    Apr 6 '16 at 11:27













up vote
31
down vote










up vote
31
down vote









This seems to work correctly. If I put your config into a file:



$ cat > compose.yml <<EOF
dns:
image: phensley/docker-dns
hostname: affy
domainname: affy.com
volumes:
- /var/run/docker.sock:/docker.sock
EOF


And then bring things up:



$ docker-compose -f compose.yml up
Creating tmp_dns_1...
Attaching to tmp_dns_1
dns_1 | 2015-04-28T17:47:45.423387 [dockerdns] table.add tmp_dns_1.docker -> 172.17.0.5


And then check the hostname inside the container, everything seems to be fine:



$ docker exec -it stack_dns_1 hostname
affy.affy.com





share|improve this answer












This seems to work correctly. If I put your config into a file:



$ cat > compose.yml <<EOF
dns:
image: phensley/docker-dns
hostname: affy
domainname: affy.com
volumes:
- /var/run/docker.sock:/docker.sock
EOF


And then bring things up:



$ docker-compose -f compose.yml up
Creating tmp_dns_1...
Attaching to tmp_dns_1
dns_1 | 2015-04-28T17:47:45.423387 [dockerdns] table.add tmp_dns_1.docker -> 172.17.0.5


And then check the hostname inside the container, everything seems to be fine:



$ docker exec -it stack_dns_1 hostname
affy.affy.com






share|improve this answer












share|improve this answer



share|improve this answer










answered Apr 28 '15 at 17:48









larsks

111k18182194




111k18182194












  • What version of Compose are you using?
    – kojiro
    Apr 28 '15 at 17:52










  • This format doesn't work in the latest version of docker-compose. YML files are finicky things; are you sure this is the right format for dns?
    – George Stocker
    Nov 24 '15 at 3:08






  • 2




    YML files aren't really all that finicky. What does "doesn't work" mean? According to the docs, both hostname and domainname are valid docker-compose.yml options. Update: just tested, still seems to work just fine (docker-compose version 1.4.2, docker version 1.8.2).
    – larsks
    Nov 24 '15 at 12:45












  • Is there any way to expose this hostname outside of the docker environment? It would be nice if the host could access the docker containers by their dns name.
    – Paul Praet
    Apr 6 '16 at 8:21










  • That is possible, and probably worth it's own question. If you search for "docker dns" you will find several relevant results; take a look at what's out there first.
    – larsks
    Apr 6 '16 at 11:27


















  • What version of Compose are you using?
    – kojiro
    Apr 28 '15 at 17:52










  • This format doesn't work in the latest version of docker-compose. YML files are finicky things; are you sure this is the right format for dns?
    – George Stocker
    Nov 24 '15 at 3:08






  • 2




    YML files aren't really all that finicky. What does "doesn't work" mean? According to the docs, both hostname and domainname are valid docker-compose.yml options. Update: just tested, still seems to work just fine (docker-compose version 1.4.2, docker version 1.8.2).
    – larsks
    Nov 24 '15 at 12:45












  • Is there any way to expose this hostname outside of the docker environment? It would be nice if the host could access the docker containers by their dns name.
    – Paul Praet
    Apr 6 '16 at 8:21










  • That is possible, and probably worth it's own question. If you search for "docker dns" you will find several relevant results; take a look at what's out there first.
    – larsks
    Apr 6 '16 at 11:27
















What version of Compose are you using?
– kojiro
Apr 28 '15 at 17:52




What version of Compose are you using?
– kojiro
Apr 28 '15 at 17:52












This format doesn't work in the latest version of docker-compose. YML files are finicky things; are you sure this is the right format for dns?
– George Stocker
Nov 24 '15 at 3:08




This format doesn't work in the latest version of docker-compose. YML files are finicky things; are you sure this is the right format for dns?
– George Stocker
Nov 24 '15 at 3:08




2




2




YML files aren't really all that finicky. What does "doesn't work" mean? According to the docs, both hostname and domainname are valid docker-compose.yml options. Update: just tested, still seems to work just fine (docker-compose version 1.4.2, docker version 1.8.2).
– larsks
Nov 24 '15 at 12:45






YML files aren't really all that finicky. What does "doesn't work" mean? According to the docs, both hostname and domainname are valid docker-compose.yml options. Update: just tested, still seems to work just fine (docker-compose version 1.4.2, docker version 1.8.2).
– larsks
Nov 24 '15 at 12:45














Is there any way to expose this hostname outside of the docker environment? It would be nice if the host could access the docker containers by their dns name.
– Paul Praet
Apr 6 '16 at 8:21




Is there any way to expose this hostname outside of the docker environment? It would be nice if the host could access the docker containers by their dns name.
– Paul Praet
Apr 6 '16 at 8:21












That is possible, and probably worth it's own question. If you search for "docker dns" you will find several relevant results; take a look at what's out there first.
– larsks
Apr 6 '16 at 11:27




That is possible, and probably worth it's own question. If you search for "docker dns" you will find several relevant results; take a look at what's out there first.
– larsks
Apr 6 '16 at 11:27










up vote
16
down vote













Based on docker documentation:
https://docs.docker.com/compose/compose-file/#/command



I simply put
hostname: <string>
in my docker-compose file.



E.g.:



[...]

lb01:
hostname: at-lb01
image: at-client-base:v1

[...]


and container lb01 picks up at-lb01 as hostname.






share|improve this answer























  • if you have multiple containers in the docker-compose file, would you set the hostname for each container? that seems very inefficient?
    – vgoklani
    Sep 19 '17 at 10:13






  • 1




    If you need well-known names for containers that's a viable solution.
    – Marcello Romani
    Oct 2 '17 at 11:48















up vote
16
down vote













Based on docker documentation:
https://docs.docker.com/compose/compose-file/#/command



I simply put
hostname: <string>
in my docker-compose file.



E.g.:



[...]

lb01:
hostname: at-lb01
image: at-client-base:v1

[...]


and container lb01 picks up at-lb01 as hostname.






share|improve this answer























  • if you have multiple containers in the docker-compose file, would you set the hostname for each container? that seems very inefficient?
    – vgoklani
    Sep 19 '17 at 10:13






  • 1




    If you need well-known names for containers that's a viable solution.
    – Marcello Romani
    Oct 2 '17 at 11:48













up vote
16
down vote










up vote
16
down vote









Based on docker documentation:
https://docs.docker.com/compose/compose-file/#/command



I simply put
hostname: <string>
in my docker-compose file.



E.g.:



[...]

lb01:
hostname: at-lb01
image: at-client-base:v1

[...]


and container lb01 picks up at-lb01 as hostname.






share|improve this answer














Based on docker documentation:
https://docs.docker.com/compose/compose-file/#/command



I simply put
hostname: <string>
in my docker-compose file.



E.g.:



[...]

lb01:
hostname: at-lb01
image: at-client-base:v1

[...]


and container lb01 picks up at-lb01 as hostname.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 25 '17 at 17:14

























answered Nov 1 '16 at 23:39









Marcello Romani

1,3451422




1,3451422












  • if you have multiple containers in the docker-compose file, would you set the hostname for each container? that seems very inefficient?
    – vgoklani
    Sep 19 '17 at 10:13






  • 1




    If you need well-known names for containers that's a viable solution.
    – Marcello Romani
    Oct 2 '17 at 11:48


















  • if you have multiple containers in the docker-compose file, would you set the hostname for each container? that seems very inefficient?
    – vgoklani
    Sep 19 '17 at 10:13






  • 1




    If you need well-known names for containers that's a viable solution.
    – Marcello Romani
    Oct 2 '17 at 11:48
















if you have multiple containers in the docker-compose file, would you set the hostname for each container? that seems very inefficient?
– vgoklani
Sep 19 '17 at 10:13




if you have multiple containers in the docker-compose file, would you set the hostname for each container? that seems very inefficient?
– vgoklani
Sep 19 '17 at 10:13




1




1




If you need well-known names for containers that's a viable solution.
– Marcello Romani
Oct 2 '17 at 11:48




If you need well-known names for containers that's a viable solution.
– Marcello Romani
Oct 2 '17 at 11:48










up vote
2
down vote













I needed to spin freeipa container to have a working kdc and had to give it a hostname otherwise it wouldn't run.
What eventually did work for me is setting the HOSTNAME env variable in compose:



version: 2
services:
freeipa:
environment:
- HOSTNAME=ipa.example.test


Now its working:



docker exec -it freeipa_freeipa_1 hostname
ipa.example.test





share|improve this answer

















  • 1




    For me, using slim, that results in a HOSTNAME environment variable that has no effect at all on the actual hostname of the container
    – Oliver Dungey
    Oct 18 at 13:52















up vote
2
down vote













I needed to spin freeipa container to have a working kdc and had to give it a hostname otherwise it wouldn't run.
What eventually did work for me is setting the HOSTNAME env variable in compose:



version: 2
services:
freeipa:
environment:
- HOSTNAME=ipa.example.test


Now its working:



docker exec -it freeipa_freeipa_1 hostname
ipa.example.test





share|improve this answer

















  • 1




    For me, using slim, that results in a HOSTNAME environment variable that has no effect at all on the actual hostname of the container
    – Oliver Dungey
    Oct 18 at 13:52













up vote
2
down vote










up vote
2
down vote









I needed to spin freeipa container to have a working kdc and had to give it a hostname otherwise it wouldn't run.
What eventually did work for me is setting the HOSTNAME env variable in compose:



version: 2
services:
freeipa:
environment:
- HOSTNAME=ipa.example.test


Now its working:



docker exec -it freeipa_freeipa_1 hostname
ipa.example.test





share|improve this answer












I needed to spin freeipa container to have a working kdc and had to give it a hostname otherwise it wouldn't run.
What eventually did work for me is setting the HOSTNAME env variable in compose:



version: 2
services:
freeipa:
environment:
- HOSTNAME=ipa.example.test


Now its working:



docker exec -it freeipa_freeipa_1 hostname
ipa.example.test






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 8 at 7:42









Roy Golan

713




713








  • 1




    For me, using slim, that results in a HOSTNAME environment variable that has no effect at all on the actual hostname of the container
    – Oliver Dungey
    Oct 18 at 13:52














  • 1




    For me, using slim, that results in a HOSTNAME environment variable that has no effect at all on the actual hostname of the container
    – Oliver Dungey
    Oct 18 at 13:52








1




1




For me, using slim, that results in a HOSTNAME environment variable that has no effect at all on the actual hostname of the container
– Oliver Dungey
Oct 18 at 13:52




For me, using slim, that results in a HOSTNAME environment variable that has no effect at all on the actual hostname of the container
– Oliver Dungey
Oct 18 at 13:52


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f29924843%2fhow-do-i-set-hostname-in-docker-compose%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

If I really need a card on my start hand, how many mulligans make sense? [duplicate]

Alcedinidae

Can an atomic nucleus contain both particles and antiparticles? [duplicate]