Sha256: 98db804b361479d539bac63e1978ae48bcbe0846cb87617d2ced93c6e8bf394b

Contents?: true

Size: 806 Bytes

Versions: 1

Compression:

Stored size: 806 Bytes

Contents

#!/bin/bash -efu

if [[ -n "${VAGRANT_LOG:-}" ]]; then
  set -x
fi

cmd="$1"; shift
case "$cmd" in
  run-instance)
    image="$1"; shift
    cmd_bootstrap="$(which shell-docker-$image 2>&- || true)"
    if [[ -x "$cmd_bootstrap" ]]; then
      $cmd_bootstrap
    fi
    docker run -privileged -d -w /root -h "$(basename "$(pwd)")" "$image" "$@"
    ;;
  terminate-instance)
    instance="$1"; shift
    docker stop "$instance" 
    ;;
  ssh-info)
    instance="$1"; shift
    echo "$(docker inspect -format '{{.NetworkSettings.IPAddress}}' $instance)" 22
    ;;
  read-state)
    instance="$1"; shift
    case "$(docker inspect -tformat '{{.State.Running}}' $instance)" in
      true)
        echo running
        ;;
      *)
        echo not_created
        ;;
    esac
    ;;
  *)
    exit 1
    ;;
esac

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-shell-0.2.17 libexec/shell-docker