User Tools

Site Tools


linux:containers:lxc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:containers:lxc [18/07/2025 16:51] – [Cloning a container] andrewlinux:containers:lxc [23/07/2025 14:38] (current) andrew
Line 4: Line 4:
 ===== Installation ===== ===== Installation =====
  
-Standard install of Ubuntu 14.04, additional packages installed are:- lxc lxctl lxc-templates, +Standard install of Ubuntu 22.04, additional packages installed are:- lxc lxctl lxc-templates, 
  
 ==== Disk layout ==== ==== Disk layout ====
Line 213: Line 213:
 Creating system-wide unprivileged containers (that is, unprivileged containers created and started by root) requires only a few extra steps to organize subordinate user IDs (uid) and subordinate group IDs (gid). Creating system-wide unprivileged containers (that is, unprivileged containers created and started by root) requires only a few extra steps to organize subordinate user IDs (uid) and subordinate group IDs (gid).
  
-Specifically, you need to manually allocate the subordinate uid and gid ranges to root in /etc/subuid and /etc/subgid and then set those ranges in /etc/lxc/default.conf using lxc.idmap entries.+Specifically, you need to manually allocate the subordinate uid and gid ranges to root in ''/etc/subuid'' and ''/etc/subgid'' and then set those ranges in ''/etc/lxc/default.conf'' using lxc.idmap entries.
  
 For example, if you have not done anything on your host related to subordinate uid and gid ranges, the following commands may be all you need. Before doing the following, take a look in /etc/subuid and /etc/subgid to see that the range 100000:65536 is not already in use on your host. If the range is in use, you can use another range. For example, if you have not done anything on your host related to subordinate uid and gid ranges, the following commands may be all you need. Before doing the following, take a look in /etc/subuid and /etc/subgid to see that the range 100000:65536 is not already in use on your host. If the range is in use, you can use another range.
  
-echo "root:100000:65536" >>/etc/subuid +  echo "root:100000:65536" >>/etc/subuid 
-echo "root:100000:65536" >>/etc/subgid +  echo "root:100000:65536" >>/etc/subgid 
-echo "lxc.idmap = u 0 100000 65536" >>/etc/lxc/default.conf +  echo "lxc.idmap = u 0 100000 65536" >>/etc/lxc/default.conf 
-echo "lxc.idmap = g 0 100000 65536" >>/etc/lxc/default.conf+  echo "lxc.idmap = g 0 100000 65536" >>/etc/lxc/default.conf
  
 That's it! Any container you create as root from now on will be running unprivileged.  That's it! Any container you create as root from now on will be running unprivileged. 
linux/containers/lxc.1752857513.txt.gz · Last modified: by andrew

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki