Difference between revisions of "Systemd-nspawn"

From ArchWiki
Jump to: navigation, search
m (Included warning that poweroff may shut off physical machine.)
(Can also shut down containers using: systemctl stop machine-subarch.scope)
Line 15: Line 15:
 
  pacman -Rsn linux
 
  pacman -Rsn linux
  
Once you're done with the container just shut it down with <strike>poweroff</strike>.
+
Once you're done with the container just shut it down with <code>systemctl stop machine-subarch.scope</code>. (replace "subarch" with the name of yout container)
{{Warning|I've found that this actually powers off my physical server and have yet to find a solution. --[[User:Piousminion|Piousminion]] ([[User talk:Piousminion|talk]]) 08:24, 11 August 2013 (UTC)}}
+
 
 +
{{Warning|"poweroff" within the container should also work, but I've found that this actually powers off my physical server and have yet to find a solution. --[[User:Piousminion|Piousminion]] ([[User talk:Piousminion|talk]]) 08:24, 11 August 2013 (UTC)}}

Revision as of 15:49, 12 August 2013

Quick guide on how to create a lightweight systemd container for Arch Linux, using systemd-nspawn and pacstrap, in under 1 minute!

Installation

pacman -S arch-install-scripts
mkdir /srv/subarch
pacstrap -c -d /srv/subarch base
systemd-nspawn -bD /srv/subarch

And that's it! Log in as "root" with no password.

You can remove the kernel to save space within the container. DO NOT RUN THIS ON THE HOST!

pacman -Rsn linux

Once you're done with the container just shut it down with systemctl stop machine-subarch.scope. (replace "subarch" with the name of yout container)

Warning: "poweroff" within the container should also work, but I've found that this actually powers off my physical server and have yet to find a solution. --Piousminion (talk) 08:24, 11 August 2013 (UTC)