To create an unprivileged LXC container on Ubuntu 14.04 LTS, follow these steps:
- Install the LXC package:
sudo apt-get update
sudo apt-get install lxc
- Create the container configuration file:
sudo lxc-create -n <container-name> -t download -- --dist ubuntu --release trusty --arch amd64
This will create a container based on Ubuntu 14.04 LTS (trusty
) with the architecture amd64
. Replace <container-name>
with the desired name for the container.
- Configure the container to run as an unprivileged user:
sudo nano /var/lib/lxc/<container-name>/config
In the configuration file, add the following line:
lxc.id_map = u 0 100000 65536
lxc.id_map = g 0 100000 65536
This sets the UID and GID map for the container, so that it runs as an unprivileged user.
- Start the container:
sudo lxc-start -n <container-name>
This will start the container and you should be able to log in and use it as an unprivileged user.
Note that these steps are a basic example and may need to be adjusted for your specific use case. For more information, you should refer to the official LXC documentation.