Docker-compose.yml Error - Cannot use 'INITSYSTEM' with an unprivileged container

I’m trying to add a mongo db to my resin project so I’m restructuring my docker image to have two services - the server and db. I’m running into this error when I try to push to my resin master -

[Info]    Starting build for biohub
[Info]    Dashboard link: https://dashboard.resin.io/apps/...
[Error]   Cannot use 'INITSYSTEM' with an unprivileged container in "server".
[Error]   Not deploying release.

I’ve had my server deployed with just a Dockerfile.template for a few months now and I’ve just being trying to migrate it to a structure similar to the multicontainer sample project (https://github.com/resin-io-projects/multicontainer-getting-started/blob/master/docker-compose.yml). Does anyone know how to resolve this error?

./docker-compose.yml

version: '2'
services:
    server:
        build: ./server
    expose:
        - "80"

./server/Dockerfile.template

FROM resin/%%RESIN_MACHINE_NAME%%-node:6-slim
RUN apt-get update && apt-get install -yq \
    alsa-utils libasound2-dev && \
    apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
COPY package.json package.json
RUN JOBS=MAX npm install && npm cache clean --force && rm -rf /tmp/*
COPY . ./
ENV INITSYSTEM on
EXPOSE 80
CMD ["npm", "start"]

Hi,

In your Dockerfile you define:
ENV INITSYSTEM on
which means that there will by an init system like systemd running inside your container. This init system cannot run in an unprivileged container.
There are two options:

  1. You make the container privileged, meaning giving it much more control. You would have to add privileged: true to the server entry in your docker-compose file.
  2. You can disable the INITSYSTEM in your Dockerfile: ENV INITSYSTEM off

Best regards,
Andreas

2 Likes