Activate a self created service on a container

I am creating a container and inside the container I am compiling my app. the service is created during the installation which means I can’t use the line :
systemctl enable service.service since the service doesn’t exist yet.

when I try to activate it after the compilation I get an error message:
Failed to get D-Bus connection: Operation not permitted

any idea how to solve it when a service is created within the container and does n’t exist during the creation.

many thnaks

No, you just can’t use systemctl at all.

Don’t bother trying to run (or, if it’s tricky, install) the init script for your application. Just use the Dockerfile CMD directive to run it.

RUN ./configure \
 && make \
 && make install
CMD /usr/local/bin/application

As a general rule, it’s best to never try to run systemctl or initctl or any other sort of “service” or “init” command: your containers will be simpler when you just run programs directly.

I can’t do that. the installation is a bit complex and depends on downloading changing artifacts from other resources. is there a way I can operate my application with my init script ( it is a tomcat application ) and that the tomact will remain up ( similar to a service )?

more the that,
I have 2 docker stations , in one of them I get the error prompt but the service succeeds and in the other it fails.

the working docker is version 1.9.1
the problematic one is 1.11.2

any idea?