#!/bin/sh
# chkconfig: 35 99 01
# description: Docker Container Mapserver
MY_NAME=`basename ${0}`
PID_FILE=/var/run/${MY_NAME}.pid
case "$1" in
start)
docker run -p 10022:22 -p 12812:2812 -p 5432:5432 -p 10080:80 \
-v /home/atsushi/git/DockerExam/ubuntu_mapserver/maps:/opt/maps:rw \
-v /home/atsushi/git/DockerExam/ubuntu_mapserver/mapcache:/opt/mapcache:rw \
-v /home/atsushi/git/DockerExam/ubuntu_mapserver/html:/var/www/html:rw \
-d atsushi/ubuntu_mapserver > $PID_FILE
;;
stop)
if [ -f $PID_FILE ]; then
docker stop `cat $PID_FILE`
rm $PID_FILE
fi
;;
restart)
$0 stop
$0 start
;;
\*)
echo "usage: $0 (start|stop|restart|help)"
esac
$ sudo /etc/init.d/docker_mapserver start
$ cat /var/run/docker_mapserver.pid
faced63851f4119fc1eda6c79f2d051aa18b196f5668d1581098ffed1ad6506f
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
faced63851f4 atsushi/ubuntu_mapserver:latest "/usr/bin/monit -I" 3 minutes ago Up 3 minutes 0.0.0.0:5432->5432/tcp, 0.0.0.0:10022->22/tcp, 0.0.0.0:10080->80/tcp, 0.0.0.0:12812->2812/tcp sad_heisenberg