Mindmajix

Docker Deployment tools

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.

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:

Screenshot_16

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

Screenshot_17

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:

docker deployment tools


0 Responses on Docker Deployment tools"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.
Course Adviser

Fill your details, course adviser will reach you.