Difference between revisions of "PVE LXC Containers"

From Da Nerd Mage Wiki
Jump to navigation Jump to search
Line 19: Line 19:
Now that you have a template to start from, you can hit the '''Create CT''' button.
Now that you have a template to start from, you can hit the '''Create CT''' button.


For now, we'll create a very basic container.
For now, we'll create a very basic container. I've found that most of the defaults are fine for single service applications. The only resource I've found a need to increase so far is CPU cores.  Memory can be increased later if needed (as can CPU cores) and actual data storage should be handled outside of the boot disk anyhow.


* 1st screen: choose an '''ID#''' and a '''hostname''' for the container. Then enter the password for root on this container (twice...). Then hit '''Next'''
* 1st screen: choose an '''ID#''' and a '''hostname''' for the container. Then enter the password for root on this container (twice...). Then hit '''Next'''

Revision as of 22:53, 9 April 2023

Note: I am just beginning to learn the ins & outs of LXC containers.

So far, LXC containers are just like regular Linux (for the most part...) & the same procedures apply when building.

Building a Container

Templates

LXC Containers start with a template.

For our example here, we're going to start with a basic Debian 11 template.

This means we need to ensure we have the template on the PVE host.

  • Sign into the PVE UI & select your Local datastore
  • Select the CT Templates storage
  • Click the Templates button
  • Select a template package (we're going with debian-11-standard) then hit the Download button

Creating the Container

Now that you have a template to start from, you can hit the Create CT button.

For now, we'll create a very basic container. I've found that most of the defaults are fine for single service applications. The only resource I've found a need to increase so far is CPU cores.  Memory can be increased later if needed (as can CPU cores) and actual data storage should be handled outside of the boot disk anyhow.

  • 1st screen: choose an ID# and a hostname for the container. Then enter the password for root on this container (twice...). Then hit Next
  • 2nd screen: select the template we downloaded above. Then hit Next
  • 3rd screen: choose a storage location & boot disk size. Then hit Next
  • 4th screen: how many CPU cores you want available to the container. Then hit Next
  • 5th screen: how much memory you want available to the container. Then hit Next
  • 6th screen: set up networking (you'll note it defaults to static addressing...  silly...) Then hit Next
  • 7th screen: set up DNS (Why in heck this isn't considered part of networking...) Then hit Next
  • 8th (final) screen: Look things over to make sure they're the way you want them.  Possibly check the Start after created box. Then hit Finish

Configuring & Using the Container

Congratulations!

You have an LXC container.

At this point,, for all intents and purposes, it works just like a normal Linux VM.

There will be minor oddities, but basically, it's a lightweight VM.

Stumbling Blocks

Standard LXC containers built upon Debian seem to block non-root users from using ping...

ping: socket: Operation not permitted

Discussion & a solution

Solution #3 seems most appropriate...

  • sudo chmod u+s /usr/bin/ping