SlideShare a Scribd company logo
Linux is amazing! 1
Linux Containers
101502551 資工 2B 蔣彥亭
Linux is amazing! 2
Outline
●
What is LXC?
●
Advantages
●
Basic Usage
●
Advanced
Linux is amazing! 3
What is LXC?
●
LXC (Linux Containers) is an operating
system–level virtualization method for
running multiple isolated Linux systems
(containers) on a single control host.
Virtualization??Virtualization??
system–levelsystem–level
Linux is amazing! 4
Virtualization
●
Full virtualization
●
Ex: vmware, virtualbox, Xen
●
Paravirtualization
●
Ex: Xen, Hyper-V
●
OS-Virtualization
●
Ex: LXC, OpenVZ
Linux is amazing! 5
Advantages
●
Lightweight and resource-
friendly
●
Comprehensive process and
resource isolation
●
Rapid and Easy deployment
Linux is amazing! 6
Basic Usage
$ sudo lxc-create -t download -n <vm_name>
ex: $ sudo lxc-create -t download -n ubuntu1
$ sudo lxc-start -n <vm_name> -d
ex: $ sudo lxc-start -n ubuntu1 -d
$ sudo lxc-info -n <vm_name>
ex: $ sudo lxc-info -n ubuntu1
$ sudo lxc-ls –fancy
$ sudo lxc-stop -n <vm_name>
ex: $ sudo lxc-stop -n ubuntu1
$ sudo lxc-destroy -n <vm_name>
ex: $ sudo lxc-destroy -n ubuntu1
Linux is amazing! 7
Setting Files
●
Global:
/etc/lxc
●
Unprevileged:
~/.config/lxc
Linux is amazing! 8
Unprivileged Container
●
Create container without having
root privilege.
●
Modify ~/.config/lxc/default.conf
●
Modify /etc/lxc/lxc-usernet
lxc.id_map = u 0 100000 65536
lxc.id_map = g 0 100000 65536
lxc.network.type = veth
lxc.network.link = lxcbr0
$USER veth lxcbr0 2
Linux is amazing! 9
Unprivileged Container
●
You may need the following
command...
$ sudo apt-get install cgmanager-utils
$ sudo cgm create all $USER
$ sudo cgm chown all $USER $(id -u) $(id -g)
$ cgm movepid all $USER $$
Linux is amazing! 10
Cloning & Snapshots
$ lxc-clone -s -o C1 -n C2 #cloning
$ lxc-snapshot -n C1 #make a snapshot
$ lxc-start-ephemeral -o C1 #ephemeral
container for C1
Linux is amazing! 11
Networking
●
DHCP by domain name:
/etc/lxc/dnsmasq.conf
●
Public network access:
dhcp-host=lxcmail,10.0.3.100
dhcp-host=ttrss,10.0.3.101
iptable is unstoppable.
Linux is amazing! 12
Applications
●
Web Servers
●
VPS ( Virtual Private Server )
Linux is amazing! 13
Opps!!
●
Debug:
$ lxc-start -l info -n <vm_name> -o debug.log
Linux is amazing! 14
Q & A
Linux is amazing! 15
References
●
http://askubuntu.com/questions/2
93275/what-is-lxc-and-how-to-get
-started
●
https://linuxcontainers.org/
●
https://help.ubuntu.com/lts/serv
erguide/lxc.html
Linux is amazing! 16
Thank you for your attention.Thank you for your attention.

More Related Content

PDF
Lxc- Introduction
PDF
Lxc- Linux Containers
PPTX
Introduction to linux containers
PDF
Linux Containers From Scratch
PPTX
Union FileSystem - A Building Blocks Of a Container
PDF
Docker storage drivers by Jérôme Petazzoni
PDF
Virtualization which isn't: LXC (Linux Containers)
PPTX
Containers are the future of the Cloud
Lxc- Introduction
Lxc- Linux Containers
Introduction to linux containers
Linux Containers From Scratch
Union FileSystem - A Building Blocks Of a Container
Docker storage drivers by Jérôme Petazzoni
Virtualization which isn't: LXC (Linux Containers)
Containers are the future of the Cloud

What's hot (20)

PPTX
Linux containers – next gen virtualization for cloud (atl summit) ar4 3 - copy
PDF
Docker internals
PPTX
Realizing Linux Containers (LXC)
PDF
Linux Containers From Scratch: Makfile MicroVPS
DOCX
Isolating an applications using LXC – Linux Containers
PDF
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
PPTX
Introduction to docker
PDF
Namespaces in Linux
PPT
Storage Simplified NFS LXC K3S
PDF
Linux cgroups and namespaces
PDF
Docker 原理與實作
PDF
Let's Containerize New York with Docker!
PPTX
Container Torture: Run any binary, in any container
PDF
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
PDF
Containerize! Between Docker and Jube.
PDF
Linuxcon Barcelon 2012: LXC Best Practices
PDF
Inside Docker for Fedora20/RHEL7
PDF
Namespaces and cgroups - the basis of Linux containers
PDF
Docker for mere mortals
PDF
Introduction to Docker and deployment and Azure
Linux containers – next gen virtualization for cloud (atl summit) ar4 3 - copy
Docker internals
Realizing Linux Containers (LXC)
Linux Containers From Scratch: Makfile MicroVPS
Isolating an applications using LXC – Linux Containers
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Introduction to docker
Namespaces in Linux
Storage Simplified NFS LXC K3S
Linux cgroups and namespaces
Docker 原理與實作
Let's Containerize New York with Docker!
Container Torture: Run any binary, in any container
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Containerize! Between Docker and Jube.
Linuxcon Barcelon 2012: LXC Best Practices
Inside Docker for Fedora20/RHEL7
Namespaces and cgroups - the basis of Linux containers
Docker for mere mortals
Introduction to Docker and deployment and Azure
Ad

Similar to LXC (20)

PDF
Understanding LXC & Docker
PPTX
Containers - Cloud Phoenix March Meetup
PDF
Kubernetes 架構與虛擬化之差異
ODP
Proxmox Talk - Linux Fest Northwest 2018
PDF
Linux Containers & Docker
PPT
Develop with linux containers and docker
PDF
LXC, Docker, and the future of software delivery | LinuxCon 2013
PDF
LXC Docker and the Future of Software Delivery
PPT
2 Linux Container and Docker
PDF
Lightweight Virtualization in Linux
PPTX
Containers and OpenStack: Marc Van Hoof, Kumulus: Containers and OpenStack
PDF
IPv6 & Containers
PDF
Docker Introduction - DevOps Montreal Meetup
PDF
The State of Linux Containers
PDF
OpenVZ Linux containers
PDF
LF_OVS_17_LXC Linux Containers over Open vSwitch
PDF
Libcontainer: joining forces under one roof
PDF
Libcontainer: joining forces under one roof
PDF
Libcontainer: joining forces under one roof
PDF
OpenVZ Linux Containers
Understanding LXC & Docker
Containers - Cloud Phoenix March Meetup
Kubernetes 架構與虛擬化之差異
Proxmox Talk - Linux Fest Northwest 2018
Linux Containers & Docker
Develop with linux containers and docker
LXC, Docker, and the future of software delivery | LinuxCon 2013
LXC Docker and the Future of Software Delivery
2 Linux Container and Docker
Lightweight Virtualization in Linux
Containers and OpenStack: Marc Van Hoof, Kumulus: Containers and OpenStack
IPv6 & Containers
Docker Introduction - DevOps Montreal Meetup
The State of Linux Containers
OpenVZ Linux containers
LF_OVS_17_LXC Linux Containers over Open vSwitch
Libcontainer: joining forces under one roof
Libcontainer: joining forces under one roof
Libcontainer: joining forces under one roof
OpenVZ Linux Containers
Ad

Recently uploaded (20)

PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
L1 - Introduction to python Backend.pptx
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
ai tools demonstartion for schools and inter college
PDF
PTS Company Brochure 2025 (1).pdf.......
PPT
Introduction Database Management System for Course Database
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
System and Network Administraation Chapter 3
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
2025 Textile ERP Trends: SAP, Odoo & Oracle
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
ISO 45001 Occupational Health and Safety Management System
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
L1 - Introduction to python Backend.pptx
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
How to Migrate SBCGlobal Email to Yahoo Easily
ai tools demonstartion for schools and inter college
PTS Company Brochure 2025 (1).pdf.......
Introduction Database Management System for Course Database
Softaken Excel to vCard Converter Software.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
System and Network Administraation Chapter 3
VVF-Customer-Presentation2025-Ver1.9.pptx
CHAPTER 2 - PM Management and IT Context
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Understanding Forklifts - TECH EHS Solution
Odoo Companies in India – Driving Business Transformation.pdf
Digital Strategies for Manufacturing Companies
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus

LXC

  • 1. Linux is amazing! 1 Linux Containers 101502551 資工 2B 蔣彥亭
  • 2. Linux is amazing! 2 Outline ● What is LXC? ● Advantages ● Basic Usage ● Advanced
  • 3. Linux is amazing! 3 What is LXC? ● LXC (Linux Containers) is an operating system–level virtualization method for running multiple isolated Linux systems (containers) on a single control host. Virtualization??Virtualization?? system–levelsystem–level
  • 4. Linux is amazing! 4 Virtualization ● Full virtualization ● Ex: vmware, virtualbox, Xen ● Paravirtualization ● Ex: Xen, Hyper-V ● OS-Virtualization ● Ex: LXC, OpenVZ
  • 5. Linux is amazing! 5 Advantages ● Lightweight and resource- friendly ● Comprehensive process and resource isolation ● Rapid and Easy deployment
  • 6. Linux is amazing! 6 Basic Usage $ sudo lxc-create -t download -n <vm_name> ex: $ sudo lxc-create -t download -n ubuntu1 $ sudo lxc-start -n <vm_name> -d ex: $ sudo lxc-start -n ubuntu1 -d $ sudo lxc-info -n <vm_name> ex: $ sudo lxc-info -n ubuntu1 $ sudo lxc-ls –fancy $ sudo lxc-stop -n <vm_name> ex: $ sudo lxc-stop -n ubuntu1 $ sudo lxc-destroy -n <vm_name> ex: $ sudo lxc-destroy -n ubuntu1
  • 7. Linux is amazing! 7 Setting Files ● Global: /etc/lxc ● Unprevileged: ~/.config/lxc
  • 8. Linux is amazing! 8 Unprivileged Container ● Create container without having root privilege. ● Modify ~/.config/lxc/default.conf ● Modify /etc/lxc/lxc-usernet lxc.id_map = u 0 100000 65536 lxc.id_map = g 0 100000 65536 lxc.network.type = veth lxc.network.link = lxcbr0 $USER veth lxcbr0 2
  • 9. Linux is amazing! 9 Unprivileged Container ● You may need the following command... $ sudo apt-get install cgmanager-utils $ sudo cgm create all $USER $ sudo cgm chown all $USER $(id -u) $(id -g) $ cgm movepid all $USER $$
  • 10. Linux is amazing! 10 Cloning & Snapshots $ lxc-clone -s -o C1 -n C2 #cloning $ lxc-snapshot -n C1 #make a snapshot $ lxc-start-ephemeral -o C1 #ephemeral container for C1
  • 11. Linux is amazing! 11 Networking ● DHCP by domain name: /etc/lxc/dnsmasq.conf ● Public network access: dhcp-host=lxcmail,10.0.3.100 dhcp-host=ttrss,10.0.3.101 iptable is unstoppable.
  • 12. Linux is amazing! 12 Applications ● Web Servers ● VPS ( Virtual Private Server )
  • 13. Linux is amazing! 13 Opps!! ● Debug: $ lxc-start -l info -n <vm_name> -o debug.log
  • 14. Linux is amazing! 14 Q & A
  • 15. Linux is amazing! 15 References ● http://askubuntu.com/questions/2 93275/what-is-lxc-and-how-to-get -started ● https://linuxcontainers.org/ ● https://help.ubuntu.com/lts/serv erguide/lxc.html
  • 16. Linux is amazing! 16 Thank you for your attention.Thank you for your attention.