{"action":"reopened","issue":{"url":"https://api.github.com/repos/lxc/lxd/issues/756","labels_url":"https://api.github.com/repos/lxc/lxd/issues/756/labels{/name}","comments_url":"https://api.github.com/repos/lxc/lxd/issues/756/comments","events_url":"https://api.github.com/repos/lxc/lxd/issues/756/events","html_url":"https://github.com/lxc/lxd/issues/756","id":87389049,"number":756,"title":"Update all LXD images on images.linuxcontainers.org to use templates","user":{"login":"LenzGr","id":263427,"avatar_url":"https://avatars.githubusercontent.com/u/263427?v=3","gravatar_id":"","url":"https://api.github.com/users/LenzGr","html_url":"https://github.com/LenzGr","followers_url":"https://api.github.com/users/LenzGr/followers","following_url":"https://api.github.com/users/LenzGr/following{/other_user}","gists_url":"https://api.github.com/users/LenzGr/gists{/gist_id}","starred_url":"https://api.github.com/users/LenzGr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LenzGr/subscriptions","organizations_url":"https://api.github.com/users/LenzGr/orgs","repos_url":"https://api.github.com/users/LenzGr/repos","events_url":"https://api.github.com/users/LenzGr/events{/privacy}","received_events_url":"https://api.github.com/users/LenzGr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lxc/lxd/labels/Feature","name":"Feature","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/lxc/lxd/milestones/13","html_url":"https://github.com/lxc/lxd/milestones/lxd-0.12","labels_url":"https://api.github.com/repos/lxc/lxd/milestones/13/labels","id":1084552,"number":13,"title":"lxd-0.12","description":"","creator":{"login":"stgraber","id":2230599,"avatar_url":"https://avatars.githubusercontent.com/u/2230599?v=3","gravatar_id":"","url":"https://api.github.com/users/stgraber","html_url":"https://github.com/stgraber","followers_url":"https://api.github.com/users/stgraber/followers","following_url":"https://api.github.com/users/stgraber/following{/other_user}","gists_url":"https://api.github.com/users/stgraber/gists{/gist_id}","starred_url":"https://api.github.com/users/stgraber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stgraber/subscriptions","organizations_url":"https://api.github.com/users/stgraber/orgs","repos_url":"https://api.github.com/users/stgraber/repos","events_url":"https://api.github.com/users/stgraber/events{/privacy}","received_events_url":"https://api.github.com/users/stgraber/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":0,"state":"open","created_at":"2015-04-27T06:43:50Z","updated_at":"2015-06-16T14:25:03Z","due_on":"2015-06-23T00:00:00Z","closed_at":null},"comments":5,"created_at":"2015-06-11T15:41:49Z","updated_at":"2015-06-16T14:25:03Z","closed_at":null,"body":"When launching a container based on the CentOS 6 image available from images.linuxcontainers.org, the container's name does not resolve via the local dnsmasq service:\r\n\r\n```\r\n% lxd-images import lxc centos 6 amd64 --alias centos6\r\nDownloading the GPG key for https://images.linuxcontainers.org\r\nDownloading the image list for https://images.linuxcontainers.org\r\nValidating the GPG signature of /tmp/tmpsdubx7ai/index.json.asc\r\nDownloading the image: https://images.linuxcontainers.org/images/centos/6/amd64/default/20150604_02:16/lxd.tar.xz\r\nValidating the GPG signature of /tmp/tmpsdubx7ai/centos-6-amd64-default-20150604_02:16.tar.xz.asc\r\nImage imported as: cf90adbf650b89c0530402546fda9a0f465e6719802abafba4c126e4f1a99fdf\r\nSetup alias: centos6\r\nCreating container...done\r\nStarting container...done\r\n% lxc list noname\r\n+--------+---------+------------+------+-----------+-----------+\r\n|  NAME  |  STATE  |    IPV4    | IPV6 | EPHEMERAL | SNAPSHOTS |\r\n+--------+---------+------------+------+-----------+-----------+\r\n| noname | RUNNING | 10.0.3.236 |      | NO        | 0         |\r\n+--------+---------+------------+------+-----------+-----------+\r\n% dig noname @10.0.3.1\r\n\r\n; <<>> DiG 9.9.5-3ubuntu0.2-Ubuntu <<>> noname @10.0.3.1\r\n;; global options: +cmd\r\n;; Got answer:\r\n;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 11403\r\n;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0\r\n\r\n;; QUESTION SECTION:\r\n;noname.\t\t\t\tIN\tA\r\n\r\n;; Query time: 0 msec\r\n;; SERVER: 10.0.3.1#53(10.0.3.1)\r\n;; WHEN: Thu Jun 11 16:34:18 CEST 2015\r\n;; MSG SIZE  rcvd: 24\r\n```\r\nThere actually is an entry in the dhcp.leases file, but it shows the incorrect host name:\r\n\r\n```\r\n% grep 10.0.3.236 /var/lib/misc/dnsmasq.lxcbr0.leases\r\n1434036769 00:16:3e:d5:2b:50 10.0.3.236 LXC_NAME *\r\n```\r\n\r\nThis is likely due to `DHCP_HOSTNAME` being set to `LXC_NAME` in `/etc/sysconfig/network-scripts/ifcfg-eth0`:\r\n\r\n```\r\n% lxc exec noname /bin/bash                          \r\n[root@noname ~]# grep LXC_NAME /etc/sysconfig/network-scripts/ifcfg-eth0 \r\nDHCP_HOSTNAME=LXC_NAME\r\n```\r\n\r\nSetting `DHCP_HOSTNAME` to `noname` here and restarting the network fixes the issue and the local DNS server returns the correct IP address. However, this is cumbersome and requires some post-processing of an image when creating a container.\r\n\r\nThis problem does not exist in Ubuntu containers, because they set `send host-name = gethostname();` in `/etc/dhcp/dhclient.conf`.\r\n\r\nWhile researching this issue I stumbled over [this thread](http://centos.1050465.n5.nabble.com/CentOS-DHCP-HOSTNAME-in-ifcfg-eth0-td5032421.html), which recommends to set `DHCP_HOSTNAME` as follows:\r\n\r\n```\r\nDHCP_HOSTNAME=`hostname`\r\n```\r\n\r\nI can confirm that this resolves the problem in my case. It might make sense to update the CentOS 6 image accordingly. Not sure if this applies to CentOS 7, too."}}