Remember chroot? Container is far beyond a chrooted environment. Think of it as an isolated subsystem in a host OS, which allows running processes in complete isolation - even the hardware visible to the container is virtualized. Containers typically take much less resources than a full virtual machine because containers leverage features in host OS to facilitate isolation.
LXC is one such user interface that leverages containment features in Linux kernel and allows creation and management of containers. Each container running on the same Linux host can run a separate linux distribution. Amazing isn't it?
Containers come in very handy to create isolated environments which do not take up as much resources as running separate virtual machines do. You can use containers to host multiple web services in isolation on a single system. Another good use could be to create multiple development environments.
To create a container in LXC, you first need to have LXC installed on your Linux distribution. Once you have LXC installed, you can type this command to create a container:
To start your container:
LXC is one such user interface that leverages containment features in Linux kernel and allows creation and management of containers. Each container running on the same Linux host can run a separate linux distribution. Amazing isn't it?
Containers come in very handy to create isolated environments which do not take up as much resources as running separate virtual machines do. You can use containers to host multiple web services in isolation on a single system. Another good use could be to create multiple development environments.
To create a container in LXC, you first need to have LXC installed on your Linux distribution. Once you have LXC installed, you can type this command to create a container:
lxc-create -t download -n my-containerThe download template will list available distributions to choose from. Shortly after you make a choice, your container will be ready to run your selected distribution.
To start your container:
lxc-start -n my-container -dYou can check its status by a couple methods:
lxc-info -n my-container lxc-ls -fTo drop to shell inside your container environment:
lxc-attach -n my-containerTo stop the container:
lxc-stop -n my-containerTo remove the container:
lxc-destroy -n my-containerContainers are fun. If you have not yet played around with containers, you should.
Disclaimer: If you follow the information here, there is no warranty, I am not liable if it deletes your data, gets you hacked, burns your house down or anything else. If you follow the information contained here you do so entirely at your own risk. My views and opinions are my own and not necessarily represent the views of my current or former employers. © Raheel Hameed and www.raheelhameed.com, 2017. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to author and this website with appropriate and specific direction to the original content.
Comments
Post a Comment