Giter VIP home page Giter VIP logo

dockerw's Introduction

dockerw

A simple docker command wrapper for the rest of us.

dockerw is a tool to support creating docker images. It aims to help you to build and (locally) run docker images and hides all the command line pain.

Note: dockerw targets only 'latest' tagged images (does not impact /touch implicit tagged images)!

Usage

./dockerw [ build | run | stop | clean | status | env | help ]

build

[...]

run

clean

Command Description
build builds the docker image
run runs a docker container in foreground based on the image
stop stops all running container based on the image and removes them
clean "stop" and then removes ALL (latest) images/artifacts
status shows the status if the docker image
env list current environment variables
help display help

Installation

  1. Create a dockerw directory ahead your docker working dir and copy the dockerw.sh script to that location.
  2. Copy a dockerw script located into the working dir of a docker image. Using default values only the dockerw script is just calling the dockerw.sh:
#! /bin/bash

# call dockerw.sh, passing arguments and using env variables
. ../dockerw/dockerw.sh

You can overule the default environment like this:

#! /bin/bash

# env
BASE_NAME="my_container_context"
CONTAINER_NAME="my_container"
DOCKER_RUN_ARGS="-ti -p 1883:1883 -p 8883:8883"

# call dockerw.sh, passing arguments and using env variables
. ../dockerw/dockerw.sh

Conventions

The CONTAINER_NAME is the parent working directory base name. The default base name (BASE_NAME_DEFAULT) and default docker run arguments (DOCKER_RUN_ARGS_DEFAULT) can be changed in dockerw.sh. The image name (IMAGE_NAME) is build like this: BASE_NAME_DEFAULT/CONTAINER_NAME (e.g. jerady/ubuntu).

Environment variables

Name Description Default Example
BASE_NAME the base name of the docker container "jerady" jerady
CONTAINER_NAME the name of the docker container "$(basename 'pwd')" mosquitto
IMAGE_NAME the name of the docker image "${BASE_NAME}/${CONTAINER_NAME}" jerady/mosquitto
DOCKER_RUN_ARGS the arguments to run the container "-ti" -ti
DOCKER_RUN the docker run command to be called by ./dockerw run "docker run ${DOCKER_RUN_ARGS} --name ${CONTAINER_NAME} ${IMAGE_NAME}" docker run -ti --name mosquitto jerady/mosquitto

Author

Jens Deters // [email protected] // @jerady // www.jensd.de

(c) copyright 2016 Jens Deters

dockerw's People

Contributors

jerady avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.