Linux Containers (LXC) is an operating-system-level virtualization method for running multiple isolated Linux systems (containers) on a control host using a single Linux kernel. You need to use the lxc-console command or lxc console {container} command to log in to a running Linux container. The syntax is as follows:
Tutorial details | |
---|---|
Difficulty | Easy (rss) |
Root privileges | No |
Requirements | lxc |
Time | Less than a minute |
lxc-console -n container-name
lxc-console -n webserver
lxc-console -n pgsql
lxc console c1-www
lxc console nginx-container
To exit an lxc-console from a shell prompt:
- Open a shell prompt.
- Login to a host server called server1.
- Use the lxc-console command to log in to a running container called ‘memcache’ type: lxc-console -n memcache
- To exit an lxc-console session, type Ctrl-A followed by Q.
Here is a sample session:
Gif.01: How to disconnect from lxc-console demo
How do I exit from LXD based ‘lxc console’ session
LXD is a next generation system container manager. It offers a user experience similar to virtual machines but using Linux containers instead. The syntax is as follows:
- Open terminal window
- Another option is to log in into remote LXD server
- Use the ‘lxc console’ to log into a running container called ‘arch’: lxc console arch
- To detach and exit from the ‘lxc console’ command, press: <CTRL>+a q
Here is a sample session that shows how to disconnect from lxc console command from LXD:
LXD isn’t a rewrite of LXC, in fact it’s building on top of LXC to provide a new, better user experience. Under the hood, LXD uses LXC through liblxc and its Go binding to create and manage the containers. It’s basically an alternative to LXC’s tools and distribution template system with the added features that come from being controllable over the network.
Conclusion
You learned how to exit from lxc-console and ‘lxc console’ commands by pressing various command line under when using Linux containers such as lxc/LXD.
🐧 1 comment so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
thank you so much!