Categories
front-end

Shell Script and Docker

Here is a simple shell script that checks to see if docker is installed. If docker is installed it then filters to see if a container with a certain name is also running and  if it is not it will trigger the run command.

#!/bin/sh

clear
if [ "$(docker --version)" ]
then
    if [ "$(docker ps --filter 'name=container_name')" ]
    then
        echo "---- CONTAINER ALREADY EXISITS ----"
        NODE_ENV=local sails lift
Replace the sugary stuff with something healthy such as veggies, fruits, whole grains cialis uk  and nuts. These two aspects are important in order to help a man get and keep an erection.This medication does http://abacojet.com/cialis-6415.html cialis without prescription not act in a flash. Your entire desires of life will be complete when he is able to satisfy woman's desires and fantasies. best viagra in india As kamagra is a more cost-effective and faster-acting canadian viagra sales  medicine for ED, as it contains one of the most powerful drugs - Sildenafil Citrate.     else
        docker run --name container_name -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_USER=postgres -e POSTGRES_DB=mydatabase -p 9999:5432 -d postgres:latest
        echo "---- CONTAINER CREATED RUNNING APPLICATION ----"
        NODE_ENV=local sails lift
    fi
else 
    echo "---- DOCKER IS NOT INSTALLED ----"
fi

Good tutorial on shell scripting,