Hello,
I am trying to create a docker image for a SMTP server based on CommuniGate Pro software.
I am using Docker version 19.03.15 on Debian 9.
I already succeeded to do that with that Dockerfile :
from debian:latest
ENV DEBIAN_FRONTEND noninteractive
COPY CGatePro-Linux_6.2-15_amd64.deb /root/
RUN dpkg -i /root/CGatePro-Linux_6.2-15_amd64.deb
ADD run.sh /root/run.sh
RUN chmod +x /root/run.sh
CMD ["/root/run.sh"]
My run.sh contains the start commands of CommuniGate Pro :
#!/bin/sh
set -e
APPLICATION="/opt/CommuniGate"
BASEFOLDER="/var/CommuniGate"
SUPPLPARAMS="--logToConsole"
[ -f ${APPLICATION}/CGServer ] || exit 1
# Custom startup parameters
if [ -f ${BASEFOLDER}/Startup.sh ]; then
. ${BASEFOLDER}/Startup.sh
fi
echo "Starting CommuniGate Pro"
exec ${APPLICATION}/CGServer --Base ${BASEFOLDER} ${SUPPLPARAMS}
I start the container by :
$ docker run -d -v /var/CommuniGate-Back-node01:/var/CommuniGate \
-m 1g \
--network=cgpro-front-pp \
--name=cgpro-back-node01-pp \
--restart unless-stopped \
-v /var/CommuniGate-SharedDomains:/var/CommuniGate/SharedDomains \
-p 10021:10050 \
--ip 172.18.0.21 \
cgpro-back-node01-pp
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f50aac1980f8 gperrot:cgpro_6.2.15 "/root/run.sh" 5 seconds ago Up 5 seconds 0.0.0.0:10021->10050/tcp cgpro-back-node01-pp
The problem is that I want to stop the process /opt/CommuniGate/CGServer launched by /root/run.sh with docker exec -ti cgpro-back-node01-pp /etc/init.d/CommuniGate stop, it is automatically restarted and I don’t want that before doing certain operations.
So, I decide to not execute “/root/run.sh” in image by commenting CMD ["/root/run.sh"] or by replacing by CMD ["/bin/bash"] or CMD [“echo”, “Hello World”].
In all those cases, I can see the docker running but with a permanent restart state :
gperrot@cgpro-front-pp:~/cgpro$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
df06011d0e04 gperrot:cgpro_6.2.15_nostart "bash" 3 minutes ago Restarting (0) 18 seconds ago cgpro-back-node01-pp
If I try to see what process are running by “docker exec -ti cgpro-back-node02-pp ps”
Error response from daemon: Container … is restarting, wait until the container is running
docker logs cgpro-back-node01-pp doesn’t give any output.
Any idea how to solve that problem ?
Thanks in advance for your help.
Gilper