Create the container,

# lxc-create -n gitlab -t debian -- -r unstable

If you host is not debian, use download template lxc-create -n gitlab -t download -- --dist debian --release sid

If you want to create a bullseye container, run lxc-create -n gitlab -t download -- --dist debian --release bullseye or lxc-create -n gitlab -t debian -- -r bullseye

# lxc-start -n gitlab
# lxc-attach -n gitlab

See LXC for more details on managing a container. The steps given below are available as an ansible playbook

Now inside the container,

You will need a utf-8 locale to install postgresql. Run dpkg-reconfigure locales and choose a locale with utf-8 support (for example en_IN.UTF-8). Reboot the container (reboot command) and run lxc-attach again.

  1. Enable contrib section in /etc/apt/sources.list. apt update && apt install gitlab. Note: when gitlab is broken in ustable, install from experimental following instructions given at gitlab.

  2. During installation, choose gitlab.lxc as the hostname

  3. Disable https in debconf wizard
  4. After installation is complete, add ip address of container (ip a will list the ip address) in host machine's /etc/hosts to resolve gitlab.lxc. gitlab.lxc # Change ip address

  5. Visit http://gitlab.lxc on host browser