9.3 Logging in to Containers

You can use the lxc-console command to log in to a running container.

[root@host ~]# lxc-console -n name [-t tty_number]

If you do not specify a tty number, you log in to the first available terminal.

For example, log in to a terminal on ol6ctr1:

[root@host ~]# lxc-console -n ol6ctr1

To exit an lxc-console session, type Ctrl-A followed by Q.

Alternatively, you can use ssh to log in to a container if you install the lxc-0.9.0-2.0.5 package (or later version of this package).

Note

To be able to log in using lxc-console, the container must be running an /sbin/mingetty process for the terminal. Similarly, using ssh requires that the container is running the SSH daemon (/usr/sbin/sshd).