Failing to build image - error during dpkg install

Hi,
I’m trying to build a docker image using ubuntu as a base. I’m getting a .deb package using wget then using “dpkg -i” to install this. The deb package is http://packages.couchbase.com/releases/couchbase-sync-gateway/1.4.0/couchbase-sync-gateway-community_1.4.0-2_x86_64.deb

The failure happens during the dpkg postinst configure phase, when it tries to perform the following:
systemctl start sync_gateway
This fails with the error Failed to connect to bus: No such file or directory
Which then stops my whole build.

I’ve read this discussion of a similar failute (systemctl giving the same error in a docker container). However, that relates to the error when running the docker container, not when building the image.

The official Dockerfile for sync_gateway uses centos and that works. However, I want to use ubuntu as I want to do a couple of other things in the same container. Outside of docker, sync gateway works fine on Ubuntu. I don’t think this is a sync_gateway problem, more a problem with the docker build process that I’m doing, which is why I’m asking here.

Can anyone please help with this?

Thanks,
Giles

FYI, here is a cutdown version of my Dockerfile:

FROM ubuntu:14.04
ENV PATH $PATH:/opt/couchbase-sync-gateway/bin

RUN apt-get update && apt-get install -yq \
      wget

ARG SG_RELEASE_URL=http://packages.couchbase.com/releases/couchbase-sync-gateway
ARG SG_VERSION=1.4.1
ARG SG_PACKAGE=couchbase-sync-gateway-community_1.4.1-3_x86_64.deb
# ARG CB_SHA256=de983d0137bd2de2608e52cbfdf01de6dd9d3c1d9bc45bd0702d253245a8a234
RUN wget $SG_RELEASE_URL/$SG_VERSION/$SG_PACKAGE && \
    dpkg -i $SG_PACKAGE && \
    rm $SG_PACKAGE

# copy the default config into the container
COPY config/sync-gateway-config.json /etc/sync_gateway/config.json
# Invoke the sync_gateway executable by default
ENTRYPOINT ["sync_gateway"]
# If user doesn't specify any args, use the default config
CMD ["/etc/sync_gateway/config.json"]

EXPOSE 4984 4985

Hi,

I have my answer now. The problem is that systemd is not running in the ubuntu docker. My solution is to use “dpkg --unpack” rather than “dpkg --install”, then run a cut down version of the postinst script separately.

Thanks,
Giles