Linux Container: Difference between revisions

From Proxmox VE
Jump to navigation Jump to search
No edit summary
Line 3: Line 3:
<b>NOTE: BETA Technology preview</b>
<b>NOTE: BETA Technology preview</b>


A Linux Containers is an operating-system-level virtualization environment for running multiple isolated Linux systems on a single Linux control host ([https://en.wikipedia.org/wiki/LXC Wikipedia LXC]).  It can be be also defined as a lightweight VM but extremely fast and easy to deploy.
A Linux Container is an operating-system-level virtualization environment for running multiple isolated Linux systems on a single Linux control host ([https://en.wikipedia.org/wiki/LXC Wikipedia LXC]).  It can be also defined as a lightweight VM but extremely fast and easy to deploy.


There is not much overhead and therefore the perfect solution for effective use of resources.
There is not much overhead and therefore it's the perfect solution for effective use of resources.


No extra kernel boot is necessary on startup resulting in a super fast boot.
No extra kernel boot is necessary on startup resulting in a super fast boot.


Linux Containers are introduced in Proxmox VE 4.0 and supports the [[Storage_Model |Proxmox Storage Model]].
Linux Containers are introduced in Proxmox VE 4.0 and support the [[Storage_Model |Proxmox Storage Model]].


= System requirements  =
= System requirements  =
Line 54: Line 54:


==Start container==
==Start container==
There are two possabilities to start a container:
There are two possibilities to start a container:
either on the GUI or on the command line [[File:Start_CT.png|200px|thumb|rigth|Start Container]]
either on the GUI or on the command line [[File:Start_CT.png|200px|thumb|rigth|Start Container]]
<pre>
<pre>

Revision as of 07:18, 23 June 2015

Introduction

NOTE: BETA Technology preview

A Linux Container is an operating-system-level virtualization environment for running multiple isolated Linux systems on a single Linux control host (Wikipedia LXC). It can be also defined as a lightweight VM but extremely fast and easy to deploy.

There is not much overhead and therefore it's the perfect solution for effective use of resources.

No extra kernel boot is necessary on startup resulting in a super fast boot.

Linux Containers are introduced in Proxmox VE 4.0 and support the Proxmox Storage Model.

System requirements

  • Proxmox VE 4.0 or higher

Features

  • Support of local directories, NFS, ZFS, LVM (future support for Sheepdog, Ceph, iSCSI, DRBD and GlusterFS is planned)
  • manipulate disk size
  • Coming soon: snapshot, rollback, clone, linked clone (all these features need storage support)
  • Kernel namespaces (ipc, uts, mount, pid, network and user)
  • Apparmor profiles
  • Seccomp policies
  • Chroots (using pivot_root)
  • Kernel capabilities
  • CGroups (control groups)
  • Migration
  • Backup and restore
  • Integrated firewall
  • Network support for VLAN, IPv4, IPv6

Supported OS

  • Debian 5, 6, 7
  • CentOS 6
  • RHEL 6

Other OS are following step by step.

Manage containers

The management via command line is possible with the pct tool. But most commands can be managed via GUI.

Get a container template

All templates can be downloaded at the GUI.

DownloadContainer

NOTE: Only the supported OS work

Create container

To create a container you need a container template. described below!

Create CT

A GUI wizard will guide you through the creation process.

It is also possible to create a container with the pct command line tool. More details see manpages

pct create 112 /var/lib/vz/template/cache/debian-7.0-standard_7.0-2_i386.tar.gz -description LXC -disk 4 -hostname pvecontainer01 -memory 1024 -nameserver 8.8.8.8 
-net0 hwaddr=52:4A:5E:26:58:D7,ip=192.168.15.83/24,gw=192.168.15.1,bridge=vmbr0 -storage local -password xxxxxx

Start container

There are two possibilities to start a container:

either on the GUI or on the command line

Start Container
pct start 100

Stop container

Stopping a container can be done in a similar way like starting a container.

Stop Container
pct stop 100

Backup container

The backup can be done in three different modes: snapshot, suspend and stopped. This mode options have only an effect if the container is running.

Backup Container

Snapshot mode: this feature depends on the filesystem and so it must support snapshots. If snapshot mode is chosen but it's not supported by the filesystem the backup will be done in suspend mode.

Suspend mode: the container will be frozen during the time the backup is running. NOTE: Container is not running untill backup is done!

Stopped mode: the container will be turned off and restarted after backup.

The command line tool backing up Linux container is vzdump. For more information read vzdump manpage.

vzdump 100 -compress lzo -dumpdir /var/lib/vz/dump/ -mode snapshot -remove 0

Restore container

Restore Container

It is easy and fast to restore a container.

On the GUI it is only possible to restore a container with the same VMID and if there is no VM with this VMID.

If you need to change the VMID or override a VM you can use the command line tool pct.

For more information read the man page of pct.

pct restore 101 /var/lib/vz/dump/vzdump-lxc-100-2015_06_22-11_12_40.tar.lzo

References

Wikipedia Linux Container

Linux Container

GIT Linux Container