Public | Automated Build

Last pushed: a year ago
Short Description
Short description is empty for this repo.
Full Description

M2i3App Commands in Docker

A quick series of commands to help manage M2i3 Cloud servers

Installation

Add the following script to /usr/bin/mappc

#!/bin/bash
#
# MAPPC Command Wrapper
#

# Allow to run in CRON JOBS
if [ -t 1 ] ; then TTY_SWITCH="-t"; fi

ADDITIONAL_OPT=""

# handle TLS
if [ -n "$DOCKER_TLS_VERIFY" ]; then ADDITIONAL_OPT="$ADDITIONAL_OPT -e DOCKER_TLS_VERIFY=1"; fi
if [ -n "$DOCKER_CERT_PATH" ]; then ADDITIONAL_OPT="$ADDITIONAL_OPT -v $DOCKER_CERT_PATH:$DOCKER_CERT_PATH -e DOCKER_CERT_PATH=$DOCKER_CERT_PATH"; fi

# Use the Socket or the PORT
if [ -n "$DOCKER_HOST" ]; then 
  ADDITIONAL_OPT="$ADDITIONAL_OPT -e DOCKER_HOST=$DOCKER_HOST"
else
  ADDITIONAL_OPT="$ADDITIONAL_OPT -v /var/run/docker.sock:/var/run/docker.sock"
fi

# link to docker 1.7 dependencies
if [ -f /usr/lib/x86_64-linux-gnu/libapparmor.so.1 ]; then
  ADDITIONAL_OPT="$ADDITIONAL_OPT -v /usr/lib/x86_64-linux-gnu/libapparmor.so.1:/lib/x86_64-linux-gnu/libapparmor.so.1"
fi


#docker run -i $TTY_SWITCH --rm -v /etc/m2i3app-client/:/etc/m2i3app-client/ --net=host  -v `which docker`:/usr/bin/docker $ADDITIONAL_OPT m2i3/m2i3app-client:latest "$@"
#exit

m2i3app_client_name=m2i3app--client.0
m2i3app_client_id=`2>/dev/null docker inspect --format='{{.Id}}' $m2i3app_client_name`

if [ -z "$m2i3app_client_id" ]; then
  2>/dev/null 1>&2 docker create -v /etc/m2i3app-client/:/etc/m2i3app-client/ --net=host  -v `which docker`:/usr/bin/docker $ADDITIONAL_OPT -w=/root --name=$m2i3app_client_name m2i3/m2i3app-client:latest "loopshell"
  m2i3app_client_id=`2>/dev/null docker inspect --format='{{.Id}}' $m2i3app_client_name`
fi
2>/dev/null 1>&2 docker start $m2i3app_client_id
docker exec -i $TTY_SWITCH $m2i3app_client_id /usr/bin/client-wrapper "$@"
Docker Pull Command
Owner
m2i3
Source Repository

Comments (0)