Issue building an LXC container within a pipeline


I’m trying to build an LXC container within the gitlab pipeline using the LXC distrobuilder. I can run the set of commands locally on my machine without an issue however when I attempt to run inside of an Ubuntu build step I receive an error stating Error: Failed to create overlay: invalid argument Which occurs just as its about to build the archive of the rootfs.

I’m not sure how to proceed from here as I am not too sure as to whats causing the issue in the first place…

I’m currently running this builder on the shared-runners on

  - build

Ubuntu Bionic x86-64:
  stage: build
  image: ubuntu:bionic
    - apt update
    - apt install -y golang-go debootstrap rsync gpg squashfs-tools git
    - go get -d -v
    - cd $HOME/go/src/
    - make
    - cd $CI_PROJECT_DIR
    - $HOME/go/bin/distrobuilder build-lxc ./ubuntu-bionic_x86-64.yaml
    - mv ./rootfs.tar.xz ./ubuntu-bionic-x86_64-unifi.tar.xz
    - mv ./meta.tar.xz ./ubuntu-bionic-x86_64-unifi.meta.tar.xz
      - ubuntu-bionic-x86_64-unifi.tar.xz
      - ubuntu-bionic-x86_64-unifi.meta.tar.xz

For things I’ve tried so far:

  • I’ve attempted to set the docker driver to use overlay2 by setting:
  DOCKER_DRIVER: overlay2
  • Various versions of the Ubuntu image from 18.04 > 19.10
  • Tried installing distrobuilder from source and from snap

a snippet of the output just as the issue occurs:

 Generating locales (this might take a while)...
   en_GB.UTF-8... done
   sv_SE.UTF-8... done
 Generation complete.
 + update-locale LANG=en_GB.UTF-8
 + mount -o bind / /mnt
 + rm -rf /mnt/run/lock /mnt/run/mount /mnt/run/systemd /mnt/run/utmp
 + umount /mnt
 + rm /etc/group- /etc/gshadow- /etc/passwd- /etc/shadow-
 Error: Failed to create overlay: invalid argument