New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`hostname -i` doesn't work in running container #5410

Closed
galvez opened this Issue Mar 12, 2015 · 15 comments

Comments

Projects
None yet
4 participants
@galvez

galvez commented Mar 12, 2015

I have this pod: http://pastebin.com/GJzkLybV

# docker ps
CONTAINER ID        IMAGE                                             COMMAND                CREATED             STATUS              PORTS                    NAMES
6719460ecb83        gcr.io/analytical_rig_823/reachsocket-db:latest   "/opt/reachsocket/ma   56 minutes ago      Up 56 minutes                                k8s_mongodb-failover.823d621c_db.default.api_4891486b-c906-11e4-b624-42010af00e4a_acc28418

But:

root@k8s-reachsocket-node-2:~# docker exec -it 671 bash
root@db:/tmp/redis-stable# hostname -i
hostname: Name or service not known
@satnam6502

This comment has been minimized.

Show comment
Hide comment
@satnam6502

satnam6502 Mar 12, 2015

Contributor

@thockin -- who else can help with this?

Contributor

satnam6502 commented Mar 12, 2015

@thockin -- who else can help with this?

@satnam6502

This comment has been minimized.

Show comment
Hide comment
@satnam6502

satnam6502 Mar 12, 2015

Contributor

Continuing from IRC, @galvez wants to know the IP address of the container (pod).
hostname works, but hostname -i does not. For GCE.

When I connect to one of my containers I find that I can run hostname -i and get the pod IP.

Contributor

satnam6502 commented Mar 12, 2015

Continuing from IRC, @galvez wants to know the IP address of the container (pod).
hostname works, but hostname -i does not. For GCE.

When I connect to one of my containers I find that I can run hostname -i and get the pod IP.

@brendandburns

This comment has been minimized.

Show comment
Hide comment
@brendandburns

brendandburns Mar 12, 2015

Contributor

hostname -i has worked for me in other containers. Is this OS dependent?

Contributor

brendandburns commented Mar 12, 2015

hostname -i has worked for me in other containers. Is this OS dependent?

@galvez

This comment has been minimized.

Show comment
Hide comment
@galvez

galvez Mar 12, 2015

My containers' base image is Ubuntu 14.04.

galvez commented Mar 12, 2015

My containers' base image is Ubuntu 14.04.

@brendandburns

This comment has been minimized.

Show comment
Hide comment
@brendandburns

brendandburns Mar 12, 2015

Contributor

See:
http://askubuntu.com/questions/185070/why-i-get-hostname-name-or-service-not-known-error

perhaps?

/etc/hosts might be borked (or DNS somehow?)

On Thu, Mar 12, 2015 at 4:34 PM, Jonas Galvez notifications@github.com
wrote:

My containers' base image is Ubuntu 14.04.


Reply to this email directly or view it on GitHub
#5410 (comment)
.

Contributor

brendandburns commented Mar 12, 2015

See:
http://askubuntu.com/questions/185070/why-i-get-hostname-name-or-service-not-known-error

perhaps?

/etc/hosts might be borked (or DNS somehow?)

On Thu, Mar 12, 2015 at 4:34 PM, Jonas Galvez notifications@github.com
wrote:

My containers' base image is Ubuntu 14.04.


Reply to this email directly or view it on GitHub
#5410 (comment)
.

@satnam6502

This comment has been minimized.

Show comment
Hide comment
@satnam6502

satnam6502 Mar 12, 2015

Contributor

The container I ran hostname -i on was also Ubuntu 14.04.

Contributor

satnam6502 commented Mar 12, 2015

The container I ran hostname -i on was also Ubuntu 14.04.

@brendandburns

This comment has been minimized.

Show comment
Hide comment
@brendandburns

brendandburns Mar 12, 2015

Contributor

Jonas, can you try just running a vanilla docker container and seeing if
hostname -i works?

On Thu, Mar 12, 2015 at 4:35 PM, Satnam Singh notifications@github.com
wrote:

The container I ran hostname -i on was also Ubuntu 14.04.


Reply to this email directly or view it on GitHub
#5410 (comment)
.

Contributor

brendandburns commented Mar 12, 2015

Jonas, can you try just running a vanilla docker container and seeing if
hostname -i works?

On Thu, Mar 12, 2015 at 4:35 PM, Satnam Singh notifications@github.com
wrote:

The container I ran hostname -i on was also Ubuntu 14.04.


Reply to this email directly or view it on GitHub
#5410 (comment)
.

@galvez

This comment has been minimized.

Show comment
Hide comment
@galvez

galvez Mar 13, 2015

Guys, hostname -i doesn't work... but -I does:

hostname -I

10.132.1.23

galvez commented Mar 13, 2015

Guys, hostname -i doesn't work... but -I does:

hostname -I

10.132.1.23

@satnam6502

This comment has been minimized.

Show comment
Hide comment
@satnam6502

satnam6502 Mar 13, 2015

Contributor

Strange that asking for all addresses for the hostname works (-I) but asking for the IP (-i) does not.

Contributor

satnam6502 commented Mar 13, 2015

Strange that asking for all addresses for the hostname works (-I) but asking for the IP (-i) does not.

@galvez

This comment has been minimized.

Show comment
Hide comment
@galvez

galvez Mar 13, 2015

Note: /etc/hosts is empty on all running containers.

galvez commented Mar 13, 2015

Note: /etc/hosts is empty on all running containers.

@thockin

This comment has been minimized.

Show comment
Hide comment
@thockin

thockin Mar 13, 2015

Member

/etc/hosts should not be empty.

docker run -ti busybox cat /etc/hosts
172.17.0.11 0eb34aecf94d
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

On Thu, Mar 12, 2015 at 6:10 PM, Jonas Galvez notifications@github.com
wrote:

Note: /etc/hosts is empty on all running containers.


Reply to this email directly or view it on GitHub
#5410 (comment)
.

Member

thockin commented Mar 13, 2015

/etc/hosts should not be empty.

docker run -ti busybox cat /etc/hosts
172.17.0.11 0eb34aecf94d
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

On Thu, Mar 12, 2015 at 6:10 PM, Jonas Galvez notifications@github.com
wrote:

Note: /etc/hosts is empty on all running containers.


Reply to this email directly or view it on GitHub
#5410 (comment)
.

@satnam6502

This comment has been minimized.

Show comment
Hide comment
@satnam6502

satnam6502 Mar 13, 2015

Contributor

I'd like to try and make progress on this issue. @galvez : please can you:

  • Tell us exactly what version of Kubernetes you are using (a release? built from HEAD?).
  • We're assuming GCE
  • We're assuming nothing special has been done to the config

If you have a regular config you should have some pods running for cluster level services e.g. for logging. Can you docker exec into either the Elasticsearch logging or Kibana logging container and run hostname -i and also look at /etc/hosts? Can you view the Grafana dashboard for monitoring? Or the Kibana dashboard for logging? That would let us know that networking must be working to a good degree and then we can focus on the OS setup in the containers you are deploying.
Thank you kindly.

Contributor

satnam6502 commented Mar 13, 2015

I'd like to try and make progress on this issue. @galvez : please can you:

  • Tell us exactly what version of Kubernetes you are using (a release? built from HEAD?).
  • We're assuming GCE
  • We're assuming nothing special has been done to the config

If you have a regular config you should have some pods running for cluster level services e.g. for logging. Can you docker exec into either the Elasticsearch logging or Kibana logging container and run hostname -i and also look at /etc/hosts? Can you view the Grafana dashboard for monitoring? Or the Kibana dashboard for logging? That would let us know that networking must be working to a good degree and then we can focus on the OS setup in the containers you are deploying.
Thank you kindly.

@thockin

This comment has been minimized.

Show comment
Hide comment
@thockin

thockin Mar 13, 2015

Member

I dont think docker will create an empty hosts file - that's the fun part...
On Mar 13, 2015 9:57 AM, "Satnam Singh" notifications@github.com wrote:

I'd like to try and make progress on this issue. @galvez
https://github.com/galvez : please can you:

  • Tell us exactly what version of Kubernetes you are using (a release?
    built from HEAD?).
  • We're assuming GCE
  • We're assuming nothing special has been done to the config If you
    have a regular config you should have some pods running for cluster level
    services e.g. for logging. Can you docker exec into either the
    Elasticsearch logging or Kibana logging container and run hostname -i
    and also look at /etc/hosts? Can you view the Grafana dashboard for
    monitoring? Or the Kibana dashboard for logging? That would let us know
    that networking must be working to a good degree and then we can focus on
    the OS setup in the containers you are deploying. Thank you kindly.


Reply to this email directly or view it on GitHub
#5410 (comment)
.

Member

thockin commented Mar 13, 2015

I dont think docker will create an empty hosts file - that's the fun part...
On Mar 13, 2015 9:57 AM, "Satnam Singh" notifications@github.com wrote:

I'd like to try and make progress on this issue. @galvez
https://github.com/galvez : please can you:

  • Tell us exactly what version of Kubernetes you are using (a release?
    built from HEAD?).
  • We're assuming GCE
  • We're assuming nothing special has been done to the config If you
    have a regular config you should have some pods running for cluster level
    services e.g. for logging. Can you docker exec into either the
    Elasticsearch logging or Kibana logging container and run hostname -i
    and also look at /etc/hosts? Can you view the Grafana dashboard for
    monitoring? Or the Kibana dashboard for logging? That would let us know
    that networking must be working to a good degree and then we can focus on
    the OS setup in the containers you are deploying. Thank you kindly.


Reply to this email directly or view it on GitHub
#5410 (comment)
.

@galvez

This comment has been minimized.

Show comment
Hide comment
@galvez

galvez Mar 13, 2015

@satnam6502 You've made the right assumptions. No special config other than the pod file I shared earlier. Let me know if you still need a copy. I'll take a look at the other bits later today and update the issue.

galvez commented Mar 13, 2015

@satnam6502 You've made the right assumptions. No special config other than the pod file I shared earlier. Let me know if you still need a copy. I'll take a look at the other bits later today and update the issue.

@satnam6502 satnam6502 self-assigned this Mar 13, 2015

@thockin

This comment has been minimized.

Show comment
Hide comment
@thockin

thockin Apr 1, 2015

Member

This is almost 3 weeks old. I'm going to close it, but please reopen if it is still a problem

Member

thockin commented Apr 1, 2015

This is almost 3 weeks old. I'm going to close it, but please reopen if it is still a problem

@thockin thockin closed this Apr 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment