Merge branch 'master' of github.com:nathanstilwell/oh-my-zsh

This commit is contained in:
Nathan Stilwell 2017-04-08 14:11:06 -04:00
commit 28d16ade90
No known key found for this signature in database
GPG key ID: 47459090870D1391
2 changed files with 25 additions and 39 deletions

View file

@ -8,6 +8,8 @@ function atlas_usage {
new Create new hosts map file new Create new hosts map file
init Create ~/.hosts to store host maps in init Create ~/.hosts to store host maps in
map link /etc/hosts to map supplying map name map link /etc/hosts to map supplying map name
list show what host configs exist
show show which config is linked
USAGE USAGE
@ -43,6 +45,24 @@ function atlas_map {
fi fi
} }
function atlas_show {
if [ -d "/Users/nstilwell/.hosts" ] && [ -e "/Users/nstilwell/.hosts/$1" ]; then
head -n 4 /etc/hosts;
else
echo "Atlas not initialized";
atlas_usage;
fi
}
function atlas_list {
if [ -d "/Users/nstilwell/.hosts" ] && [ -e "/Users/nstilwell/.hosts/$1" ]; then
ls -F ~/.hosts | grep -v /$;
else
echo "Atlas not initialized";
atlas_usage;
fi
}
function atlas { function atlas {
if [ -z "$1" ]; then if [ -z "$1" ]; then
atlas_usage; atlas_usage;
@ -50,5 +70,7 @@ function atlas {
[ "$1" = "new" ] && atlas_new "$2"; [ "$1" = "new" ] && atlas_new "$2";
[ "$1" = "init" ] && atlas_init; [ "$1" = "init" ] && atlas_init;
[ "$1" = "map" ] && atlas_map "$2"; [ "$1" = "map" ] && atlas_map "$2";
[ "$1" = "show" ] && atlas_show;
[ "$1" = "list" ] && atlas_list;
fi fi
} }

View file

@ -4,7 +4,6 @@ cat <<-USAGE
usage: dock <command> usage: dock <command>
clean Remove all stopped containers clean Remove all stopped containers
info Info on Docker setup
help show Docker cheat sheet help show Docker cheat sheet
USAGE USAGE
} }
@ -15,53 +14,17 @@ function dock_clean {
[ "$1" = "images" ] && docker rmi $(docker images -q); [ "$1" = "images" ] && docker rmi $(docker images -q);
} }
function dock_info {
cat <<-INFO
You are (probably) running docker locally on a Mac using Docker Toolbox.
Docker Machine is the new boot2docker thing. You have a virtual machine
created called 'default'. You can check the status by running.
docker-machine status default
If it's not 'Running', you can bring it up with docker-machine start
You should have this in your profile:
### Docker
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/Users/nathan/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
and, you should have this in your /etc/hosts
## Docker Machine
192.168.99.100 docker d
So, you can access local running containers, by going to:
http://d:<port of container>
INFO
}
function dock_help { function dock_help {
cat <<-HELP cat <<-HELP
# list local images # list local images
docker images docker images
# build a tagged docker docker image; # build a tagged docker image;
docker build -t <tag name> <folder>; docker build -t <tag name> <folder>;
## Example:
docker build -t chicksphotocracy/photoop:latest .
# run a docker image as a daemon on a port; # run a docker image as a daemon on a port;
docker run -d --name <give it a name> -p <inside port : outside port> <tag>; docker run -d --name <give it a name> -p <inside port : outside port> <tag>;
## Example:
docker run -t -i -p 5678:5678 chicksphotocracy/photoop:1.9.0
# run bash in a container; # run bash in a container;
docker exec -ti <name, tag, or id> bash; docker exec -ti <name, tag, or id> bash;
@ -71,6 +34,8 @@ cat <<-HELP
# remove a container # remove a container
docker rm <tag, name, id> docker rm <tag, name, id>
# view logs from a container
docker logs -f <tag, name, id>
HELP HELP
} }
@ -79,7 +44,6 @@ function dock () {
dock_usage; dock_usage;
else else
[ "$1" = "clean" ] && dock_clean "$2" [ "$1" = "clean" ] && dock_clean "$2"
[ "$1" = "info" ] && dock_info
[ "$1" = "help" ] && dock_help [ "$1" = "help" ] && dock_help
fi fi
} }