lxc-console

launches a console for the specified container

TLDR

Connect to container console
$ sudo lxc-console container_name
Connect to specific tty
$ sudo lxc-console -t 1 container_name
Exit console
$ Ctrl+a q
Display help
$ lxc-console --help

SYNOPSIS

lxc-console [options] -n containername_

DESCRIPTION

lxc-console launches a console for the specified container. It connects to a tty device provided by the container's init system, allowing interactive access.

PARAMETERS

-n, --name NAME

Name of the container to connect to
-t, --tty N
Connect to tty number N instead of an available one
-e, --escape CHAR
Set escape character (default: 'a' for Ctrl+a)
-P, --lxcpath PATH
Use alternate container path
-?, --help
Display help information

INSTALL

sudo apt install lxc
sudo dnf install lxc
sudo pacman -S lxc
sudo apk add lxc
sudo zypper install lxc
brew install lxc
nix profile install nixpkgs#lxc

CAVEATS

The escape sequence to exit the console is Ctrl+a followed by q (unless changed with -e). The container must have an appropriate getty or login process running on its tty.

HISTORY

lxc-console is part of LXC (Linux Containers), providing OS-level virtualization for running multiple isolated Linux systems on a single host.

SEE ALSO

lxc-start(1), lxc-attach(1), lxc-stop(1)