Skip to content

Instantly share code, notes, and snippets.

@gdamjan
Last active May 11, 2020 10:44
Show Gist options
  • Save gdamjan/c528e3c649141c31594439a72300963e to your computer and use it in GitHub Desktop.
Save gdamjan/c528e3c649141c31594439a72300963e to your computer and use it in GitHub Desktop.
pacstrap a minimalized arch full container - you can go more minimal for a single process container

install

mkdir container
sudo pacstrap -C pacman.conf -c -d container/ systemd  iproute2
sudo sed -i 's/dns/resolve/' container/etc/nsswitch.conf
systemctl --root container/ enable systemd-networkd systemd-resolved

ps. required on host: systemd pacstrap

run

sudo systemd-nspawn -D container/ -b -n

optionally

sudo pacman -Rdd --root container/ --config pacman.conf perl kbd texinfo
sudo pacman -S --root container/ --config pacman.conf  iputils nettle
[options]
HoldPkg = pacman glibc
Architecture = auto
NoExtract = usr/include/* usr/share/man/* usr/share/info/* usr/share/locale/* usr/share/i18n/* usr/share/doc/* usr/share/gtk-doc/*
CheckSpace
VerbosePkgLists
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
$ sudo du -sh container/etc/ container/usr/*
8.9M container/etc/
30M container/usr/bin
141M container/usr/lib
0 container/usr/lib64
40K container/usr/local
0 container/usr/sbin
20M container/usr/share
4.0K container/usr/src
$ sudo pacman -Q --root container/ --config pacman.conf
acl 2.2.52-2
attr 2.4.47-1
bash 4.3.042-4
bzip2 1.0.6-5
coreutils 8.25-2
cracklib 2.9.6-1
db 5.3.28-3
dbus 1.10.8-1
e2fsprogs 1.42.13-1
expat 2.1.1-2
filesystem 2015.09-1
gcc-libs 6.1.1-1
gdbm 1.11-1
glibc 2.23-4
gmp 6.1.0-4
gzip 1.8-2
hwids 20160306-1
iana-etc 20160513-1
iproute2 4.5.0-2
iptables 1.6.0-1
iputils 20160308.0db72a4-1
keyutils 1.5.9-1
kmod 22-1
krb5 1.13.4-1
less 481-2
libcap 2.25-1
libdbus 1.10.8-1
libelf 0.166-1
libgcrypt 1.7.0-2
libgpg-error 1.22-1
libidn 1.32-1
libldap 2.4.44-2
libmnl 1.0.3-2
libnftnl 1.0.5-1
libsasl 2.1.26-7
libseccomp 2.3.1-1
libsystemd 230-3
libtirpc 1.0.1-2
libutil-linux 2.28-1
linux-api-headers 4.5.5-1
lz4 131-1
ncurses 6.0-4
nettle 3.2-2
openssl 1.0.2.h-1
pam 1.2.1-3
pambase 20130928-1
pcre 8.38-3
procps-ng 3.3.11-2
readline 6.3.008-3
shadow 4.2.1-3
sysfsutils 2.1.0-9
systemd 230-3
tzdata 2016d-1
util-linux 2.28-1
xz 5.2.2-1
zlib 1.2.8-4
@gdamjan
Copy link
Author

gdamjan commented Jun 5, 2016

ps.
the container doesn't even have pacman (nor a kernel). all pacman operations can be done by the host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment