Laure_f_o
Laure_f_o

Reputation: 618

Docker stop exiting with 0

I am getting crazy.... I cannot understand why my container stops just after run.

this is my Dockfile:

FROM debian:latest

ENV DEVICE name
ENV PASSWORD pass

COPY install.sh /
#debdir is a directory
COPY debdir /debdir
RUN chmod +x /install.sh

CMD ["/install.sh"]
EXPOSE 5000 5314

and the install.sh:

#!/bin/bash
dpkg -i /debdir/*.deb
/opt/MXB/sbin/configure-fp.sh --user=$DEVICE --password=$PASSWORD --encryption-method="AES-128" --encryption-key="SECUR_ITY2014a" --use-proxy=false

Can you help me?

when the service "mxb" finish starting the container will exit with 0 instead of keep runnig with option -i -t, I tried with -dit too.

I run with this:

sudo docker run -i -t -p 5000:5000 -p 5314:5314 -e "DEVICE=device" -e "PASSWORD=pass" --name iaso_mxb iaso_mxb

many thanks.

logs:

sudo docker logs af6bbff2a4f1
Selecting previously unselected package mxb.
(Reading database ... 7562 files and directories currently installed.)
Preparing to unpack /debdir/mxb_~linux-1_amd64.deb ...
Verifying archive integrity... All good.
Uncompressing ......
'./var/log/BRMigrationTool/BRMigrationTool_2017_05_30.log' -> '/tmp/BRMigrationTool_2017_05_30.log'
Unpacking mxb (17.4.1.17122-1) ...
Setting up mxb (17.4.1.17122-1) ...
invoke-rc.d: policy-rc.d denied execution of start.
Processing triggers for systemd (215-17+deb8u7) ...
Functional Process configuration tool, version 17.4.1.17122
Copyright (c) 2017 MXB

[ ok ] Starting ProcessController:.

Initialization in progress. It can take a while...
...
...
Functional process initialized successfully.

in this point the service should keep running.

Upvotes: 0

Views: 57

Answers (1)

user2915097
user2915097

Reputation: 32166

your container lives as long as it has something to do in the

CMD

or

ENTRYPOINT

directive of the Dockerfile, then it exits.

By the way what do you expect it to do?

A Nginx container launches Nginx, a MongoDB launches a MongoDB database...

This is normal and you may, for example, add

;sleep infinity

at the end of your install.sh

Upvotes: 3

Related Questions