User Tools

Site Tools


Differences

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

Link to this comparison view

en:public:lxc_alpine [2018/02/13 17:36] (current)
jschlehofer created
Line 1: Line 1:
 +====== How to have Alpine Linux in LXC container working and running ======
  
 +For LXC containers we're using images from [[https://​uk.images.linuxcontainers.org/​images/​|LinuxContainers.org]],​ but they or somebody else decided to remove images for armhf architecture,​ which we use in Turris Omnia a few days ago. \\
 +Now we're using minimal root filesystem directly from Alpine developers from their official [[https://​alpinelinux.org/​|website]],​ but they'​re primarily made for chroot or Docker.
 +I created [[https://​github.com/​lxc/​lxc/​issues/​2161|issue on Github]] and hopefully they bring back Alpine images for armhf at LinuxContainers.org
 +
 +First I will show you how to install Alpine in LXC containers and then we'll need to do some stuff like setup network manually and install busybox-initscripts and after reboot or each start of LXC containers to have networking connection.
 +
 +This manual was tested by a community for Alpine version 3.6 a 3.7.
 +
 +===== Usage for LXC containers =====
 +
 +Can be find here https://​doc.turris.cz/​doc/​en/​public/​lxc_for_beginners
 +
 +===== Install =====
 +
 +Login to the SSH and install LXC containers how it is advised in [[https://​doc.turris.cz/​doc/​en/​howto/​lxc|official LXC article]] so it means that first, you need USB flash drive or hard drive, where do you install LXC container and then you need enter the folder, where you have it mounted and do this command:
 +
 +<​code>​
 +lxc-create -t download -n nameofyourcontainer
 +</​code>​
 +
 +Now you need to attach it with this command
 +
 +<​code>​
 +lxc-attach -n nameofyourcontainer
 +</​code>​
 +
 +Now you need to setup network manually by this
 +
 +<​code>​mount -t proc proc proc/
 +ifconfig eth0 x.x.x.x netmask y.y.y.y up
 +route add default gw z.z.z.z
 +echo "​nameserver 8.8.8.8"​ > /​etc/​resolv.conf</​code>​
 +
 +Now you need to add initialization scripts
 +<​code>​
 +apk update
 +apk add busybox-initscripts
 +</​code>​
 +
 +Create configuration file for network ''/​etc/​network/​interfaces''​ with content
 +
 +<​code>​
 +auto eth0
 +iface eth0 inet dhcp
 +hostname $(hostname)
 +</​code>​
 +
 +Set automatic startup for network
 +<​code>​
 +rc-update add networking
 +rc-update add bootmisc boot
 +rc-update add syslog boot
 +</​code>​
 +
 +Now you need to **reboot** it and it's done. :-)