27.5 Monitoring and Shutting Down Containers

To display the containers that are configured, use the
lxc-ls command on the host.

[root@host ~]# lxc-ls
ol6ctr1
ol6ctr2

To display the containers that are running on the host system,
specify the --active option.

[root@host ~]# lxc-ls --active
ol6ctr1

To display the state of a container, use the
lxc-info command on the host.

[root@host ~]# lxc-info -n ol6ctr1
state: RUNNING
pid: 10171

A container can be in one of the following states:
ABORTING, RUNNING,
STARTING, STOPPED, or
STOPPING. Although lxc-info
might show your container to be in the RUNNING
state, you cannot log in to it unless the
/usr/sbin/sshd or
/sbin/mingetty processes have started running
in the container. You must allow time for the
/sbin/init process in the container to first
start networking and the various other services that you have
configured.

To view the state of the processes in the container from the host,
either run ps -ef --forest and look for the
process tree below the lxc-start process or use
the lxc-attach command to run the
ps command in the container.