OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

6.2.3. Basic unprivileged usage‌


To create unprivileged containers, a few first steps are needed. You will need to create a default container configuration file, specifying your desired id mappings and network setup, as well as configure the host to allow the unprivileged user to hook into the host network. The example below assumes that your mapped user and group id ranges are 100000-165536. Check your actual user and group id ranges and modify the example accordingly:


grep $USER /etc/subuid grep $USER /etc/subgid


mkdir -p ~/.config/lxc

echo "lxc.id_map = u 0 100000 65536" > ~/.config/lxc/default.conf

echo "lxc.id_map = g 0 100000 65536" >> ~/.config/lxc/default.conf echo "lxc.network.type = veth" >> ~/.config/lxc/default.conf

echo "lxc.network.link = lxcbr0" >> ~/.config/lxc/default.conf echo "$USER veth lxcbr0 2" | sudo tee -a /etc/lxc/lxc-usernet


After this, you can create unprivileged containers the same way as privileged ones, simply without using sudo.


lxc-create -t download -n u1 -- -d ubuntu -r bionic -a amd64 lxc-start -n u1 -d

lxc-attach -n u1 lxc-stop -n u1 lxc-destroy -n u1


Top OS Cloud Computing at OnWorks: