TWiki
>
CF Web
>
Linux
>
LinuxContainers
(2017-01-18,
AdrianPepper
)
(raw view)
E
dit
A
ttach
---+ Linux Containers Many of CSCF's servers run using LXC (!LinuX Containers) (see: http://en.wikipedia.org/wiki/LXC ) Here we document the most useful commands for working with these containers %TOC% ---++ Background information * Ubuntu documentation: https://help.ubuntu.com/12.04/serverguide/lxc.html * https://help.ubuntu.com/16.04/serverguide/lxc.html * [[http://lxc.sourceforge.net/man/][man pages for lxc and friends]] * ht%NOP%tp://lxc.sourceforge.net/ top-level now redirects to * https://linuxcontainers.org/ <BR> Perhaps there see... * https://linuxcontainers.org/lxc/ * https://linuxcontainers.org/lxc/news/ * [[LxcStart][CSCF non-twiki LXC documentation (Dave)]] ---+++ LXD — Just Say No! * You may stumble across the presumptuously-named =lxd= package. For now we avoid that for a number of reasons. * https://linuxcontainers.org/lxd/ * https://help.ubuntu.com/16.04/serverguide/lxd.html ---++ Names of current container host servers * [[https://cs.uwaterloo.ca/cscf/student/hosts]] currently contains a list of many container hosts. To access the hostname use the domain ".cloud.cs.uwaterloo.ca" or ".storage.cs.uwaterloo.ca". (I'm currently not sure what difference there is to using either). You might also be able to search Infoblox and find host names that way. * [[https://cs.uwaterloo.ca/cscf/cscfnow/inventory/lxc-Container-list.shtml]] has an automatically generated list of the state of containers on each IAAS host. ---++ Listing the containers on a server * lxc-ls <pre> root@mc-cloud002-n1:# lxc-ls bs002.student.cs.uwaterloo.ca db2a.student.cs.uwaterloo.ca mails.student.cs.uwaterloo.ca postgres060.student.cs.uwaterloo.ca bs004.student.cs.uwaterloo.ca flexlm202.cscf.uwaterloo.ca mysql070.student.cs.uwaterloo.ca region.student.cs.uwaterloo.ca bs004.student.cs.uwaterloo.ca flexlm202.cscf.uwaterloo.ca mysql070.student.cs.uwaterloo.ca postgres060.student.cs.uwaterloo.ca db2a.student.cs.uwaterloo.ca mails.student.cs.uwaterloo.ca postgres060.student.cs.uwaterloo.ca region.student.cs.uwaterloo.ca </pre> * lxc-ls -l <pre> root@mc-cloud002-n1:# lxc-ls -l total 0 drwxr-xr-x 1 root root 56 Nov 13 16:52 bs002.student.cs.uwaterloo.ca drwxr-xr-x 1 root root 56 Nov 15 12:47 bs004.student.cs.uwaterloo.ca drwxr-xr-x 1 root root 56 Feb 11 17:26 db2a.student.cs.uwaterloo.ca drwxr-xr-x 1 root root 56 Sep 5 21:57 flexlm202.cscf.uwaterloo.ca drwxr-xr-x 1 root root 62 Oct 3 17:37 mails.student.cs.uwaterloo.ca drwxr-xr-x 1 root root 56 Nov 29 15:23 mysql070.student.cs.uwaterloo.ca drwxr-xr-x 1 root root 56 Aug 17 19:24 postgres060.student.cs.uwaterloo.ca drwxr-xr-x 1 root root 56 Jul 19 2012 region.student.cs.uwaterloo.ca drwxr-xr-x 2 root root 0 Nov 29 15:16 bs004.student.cs.uwaterloo.ca drwxr-xr-x 2 root root 0 Feb 11 17:19 db2a.student.cs.uwaterloo.ca drwxr-xr-x 2 root root 0 Nov 29 15:16 flexlm202.cscf.uwaterloo.ca drwxr-xr-x 2 root root 0 Nov 29 15:16 mails.student.cs.uwaterloo.ca drwxr-xr-x 2 root root 0 Nov 29 15:23 mysql070.student.cs.uwaterloo.ca drwxr-xr-x 2 root root 0 Nov 29 15:16 postgres060.student.cs.uwaterloo.ca drwxr-xr-x 2 root root 0 Nov 29 15:16 postgres060.student.cs.uwaterloo.ca drwxr-xr-x 2 root root 0 Nov 29 15:16 region.student.cs.uwaterloo.ca </pre> ---++ Get information about a container * lxc-info --name <container name> ---+++ a running system <pre> root@mc-cloud002-n1:# lxc-info --name mails.student.cs.uwaterloo.ca state: RUNNING pid: 8331 </pre> ---+++ a stopped system <pre> root@mc-cloud002-n1:# lxc-info --name db2a.cloud.cs.uwaterloo.ca state: STOPPED lxc-info: 'db2a.cloud.cs.uwaterloo.ca' is not running </pre> ---++ Accessing the console * lxc-console --name <container name> <pre> root@mc-cloud002-n1:# lxc-console --name mails.student.cs.uwaterloo.ca Type <Ctrl+a q> to exit the console Ubuntu 12.04 LTS mails tty1 mails login: </pre> ---+++ lxc-attach * You can also use 'lxc-attach --name <container name>' if you don't know the root password * If you are in the habit of accessing containers via ssh, lxc-attach will allow you access (as super-user on the containing host) if sshd did not start on the container (or is not even installed)
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r6
<
r5
<
r4
<
r3
<
r2
|
B
acklinks
|
V
iew topic
|
WYSIWYG
|
M
ore topic actions
Topic revision: r6 - 2017-01-18
-
AdrianPepper
CF
Information in this area is meant for use by CSCF staff and is not official documentation, but anybody who is interested is welcome to use it if they find it useful.
CF Web
CF Web Home
Changes
Index
Search
Administration
Communication
Email
Hardware
HelpDeskGuide
Infrastructure
InternalProjects
Linux
MachineNotes
Macintosh
Management
Networking
Printing
Research
Security
Software
Solaris
StaffStuff
TaskGroups
TermGoals
Teaching
UserSupport
Vendors
Windows
XHier
Other Webs
CSEveryBody
Main
Sandbox
TWiki
UW
My links
People
CERAS
WatForm
Tetherless lab
Ubuntu Main.HowTo
eDocs
RGG NE notes
RGG
CS infrastructure
Grad images
Edit
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback