El 26/5/20 a las 23:35, Antonio Terceiro escribió:
> is there an easy/documented way of reproducing the salsa ci environment
> (i.e. lxc working under docker) locally? 

Attached is a Dockerfile. It should be sufficient to reproduce the problem.

Changing the FROM statement from debian:unstable to debian:testing is
enough to make it work. It needs to be run as privileged.

$ docker build -t autopkgtest - < Dockerfile
$ docker run --rm --privileged autopkgtest

-- 
- ina
FROM debian:unstable

ENV SALSA_CI_AUTOPKGTEST_LXC 
https://salsa.debian.org/salsa-ci-team/autopkgtest-lxc
ENV LXC_PATH /lxc

# Download and configure container.
RUN apt-get update && apt-get install -y wget
RUN wget --progress=dot:giga 
${SALSA_CI_AUTOPKGTEST_LXC}/-/jobs/artifacts/master/raw/artifacts/lxc.tar?job=stable
 -O lxc.tar
RUN mkdir ${LXC_PATH} && tar xf lxc.tar -C ${LXC_PATH}
RUN sed -i "/lxc.rootfs.path/ s@dir:.*/lxc/@dir:${LXC_PATH}/@" 
${LXC_PATH}/autopkgtest-stable-amd64/config

# Install lxc.
RUN apt-get update && apt-get install -y eatmydata
RUN eatmydata apt-get install -y lxc iptables

RUN echo "lxc.lxcpath=${LXC_PATH}" | tee -a /etc/lxc/lxc.conf
RUN echo 'USE_LXC_BRIDGE="true"' | tee /etc/default/lxc-net

RUN echo 'tmpfs /sys/fs/cgroup tmpfs rw,relatime,seclabel' | tee /etc/fstab
RUN echo 'cgroup /sys/fs/cgroup/cpuset cgroup rw,relatime,cpuset,x-mount.mkdir' 
| tee -a /etc/fstab
RUN echo 'cgroup /sys/fs/cgroup/devices cgroup 
rw,relatime,devices,x-mount.mkdir' | tee -a /etc/fstab

# This steps need to be run as privileged.
CMD umount -R /sys/fs/cgroup && mount -a && \
    /etc/init.d/lxc-net start && \
    /etc/init.d/lxc start && \
    lxc-start autopkgtest-stable-amd64 && \
    lxc-stop autopkgtest-stable-amd64 && \
    echo "ok"

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to