Hello,
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.
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 )?