Blog

Docker Deployment tools

Email This Post

Docker deployment can frustrate most of the Docker users. However, there are tools which have been developed so as to help in solving this problem. Let us discuss some of these tools.

Learn how to use Docker, from beginner basics to advanced techniques, with online video tutorials taught by industry experts. Enroll for FreeDocker TrainingDemo!

Captainhook

We need to demonstrate how we can use this tool so as to deploy the Docker. In the configuration directory, you should have a configuration file with the following code:
{
“scripts”: [
{
“command”: “/root/gablog.sh”,
“args”: [
“4”
]
}
]
}
Note that in the above code, we have a script named “gablosh.sh.” The following is the code for the script:
# /root/gablog.sh
if [ -z “$1” ]
then
echo “usage : gablog.sh 4 — starting four new instances”
exit -1
fi
echo “Getting the gablog containers which are currently running”
OLDPORTS=( `docker ps | grep gacademy-web | awk ‘{print $1}’` )
echo “pull the new version”
docker pull bkn/gacademy-web
echo “Launching new containers”
for j in `seq 1 $1` ; do
docker run -d -e VIRTUAL_HOST=blog.gacademy.com -p 80 bkn/gacademy-web
done
echo “remove the old containers”
for j in ${OLDPORTS[@]}
do
echo “remove the old container $j”
docker kill $j
done
The container might look complicated to some of you. However, it looks for the containers which are running, and then it stores them. For the case of the old containers, they are deleted from the system. You can then run the command given below:

The command will launch captainhook and the configuration directory which we have specified. You can then use curl for the purpose of testing this:

A simple response from the server should be observed. The container should also be running by this time, and this can be verified by execution of the “docker ps” command. To make the script “gablog.sh” executable, use the following command:
chmod +x gablog.sh
The deployment process will give us the following:

Join MindMajix Network

Mindmajix - Online global training platform connecting individuals with the best trainers around the globe. With the diverse range of courses, Training Materials, Resume formats and On Job Support, we have it all covered to get into IT Career. Instructor Led Training - Made easy.