You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When I deploy an image as a service in a Docker Swarm environment, the /etc/hosts of the container is populated in different manner. I found that the hostname of the container is not added when I use --publish PORT option.
I build this image to test: fabrizio2210/test-hostname:latest
This is is the Dockerfile:
FROM arm32v7/busybox
COPY script.sh script.sh
CMD [ "./script.sh"]
And this is the content of the script.sh:
#!/bin/sh
cat /etc/hosts
while true; do
sleep 5
done
Steps to reproduce the issue:
Deploy the service using this command: docker service create --name test fabrizio2210/test-hostname:latest
Check output of the container or enter in the container to "cat" the /etc/hosts
You can see the couple IP of the container and hostname like: 172.17.0.2 a3108c5bfefb
Deploy the same service with the published port: docker service create --name test --publish 80 fabrizio2210/test-hostname:latest
Check output of the container or enter in the container to "cat" the /etc/hosts
There is no hostname in /etc/hosts except for localhost
Description
When I deploy an image as a service in a Docker Swarm environment, the /etc/hosts of the container is populated in different manner. I found that the hostname of the container is not added when I use --publish PORT option.
I build this image to test: fabrizio2210/test-hostname:latest
This is is the Dockerfile:
And this is the content of the script.sh:
Steps to reproduce the issue:
docker service create --name test fabrizio2210/test-hostname:latest
You can see the couple IP of the container and hostname like:
172.17.0.2 a3108c5bfefb
docker service create --name test --publish 80 fabrizio2210/test-hostname:latest
There is no hostname in /etc/hosts except for localhost
Describe the results you received:
Describe the results you expected:
Additional information you deem important (e.g. issue happens only occasionally):
The issue always happens
Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
The environment is on raspberry pi 3
The text was updated successfully, but these errors were encountered: