[Lxc-users] Is there a way to get the container name from inside the container?

Michael H. Warfield mhw at WittsEnd.com
Tue May 21 12:19:25 UTC 2013


On Mon, 2013-05-20 at 21:30 -0700, Masood Mortazavi wrote:
> I seem recall that the host name is the same as container name.
> Try to print/view the host name while in the conatiner.
> You can also configure your .bash_profile to ensure the host name (i.e the
> container name in this case) appears on your bash command prompt.

By default it is but that's not required.  If you create it with
lxc-create, then the container name, the "lxc.utsname" in the config and
the hostname of the system will be the same.  After the container has
been created, these can be changed independently.  The question has also
been raised (by me) over on the -devel list of setting the utsname and
the host name to an FQDN (Fully Qualified Domain Name) based on the
container name and the domain name of the host or by an independent
template creation object (--fqdn), since it's generally desirable for
those two to be an FQDN while keeping the container name to a simple
name.  I would not depend on the host name to match the container name
unless this is a site convention you enforce locally.

Regards,
Mike

> Good luck,
> m.
> 
> 
> 
> On Thu, May 16, 2013 at 2:08 PM, Vallevand, Mark K <
> Mark.Vallevand at unisys.com> wrote:
> 
> > Is there a way to get the container name from inside the container?****
> >
> > ** **
> >
> > Regards.
> > Mark K Vallevand   Mark.Vallevand at Unisys.com****
> >
> > May you live in interesting times, may you come to the attention of
> > important people and may all your wishes come true.****
> >
> > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> > MATERIAL and is thus for use only by the intended recipient. If you
> > received this in error, please contact the sender and delete the e-mail and
> > its attachments from all computers.****
> >
> > ** **
> >
> >
> > ------------------------------------------------------------------------------
> > AlienVault Unified Security Management (USM) platform delivers complete
> > security visibility with the essential security capabilities. Easily and
> > efficiently configure, manage, and operate all of your security controls
> > from a single console and one unified framework. Download a free trial.
> > http://p.sf.net/sfu/alienvault_d2d
> > _______________________________________________
> > Lxc-users mailing list
> > Lxc-users at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/lxc-users
> >
> >
> 
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service 
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________ Lxc-users mailing list Lxc-users at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users

-- 
Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20130521/f35280dd/attachment.pgp>


More information about the lxc-users mailing list