Skip to content

Instantly share code, notes, and snippets.

@cdpb
cdpb / gist:f899f8adbcd643eb9bb2
Created February 16, 2016 08:41
simple iptables to secure docker from host
#!/bin/bash
# for coreos with flannel ...
# Example use ./iptables.sh --source 172.16.23.0/24 --destination 172.16.23.1 --local 10.2.0.2 --dry-run true
while [[ $# > 1 ]]
do
ARGS="$1"
case $ARGS in
-s|--source)
@cdpb
cdpb / gist:a637932a4af906b0dbf7
Last active February 20, 2016 14:26
Automatic Docker Clean
#!/bin/bash
echo "clean containers ..."
docker ps --filter status=exited -aq | xargs --no-run-if-empty docker rm -vf
echo "clean images ..."
docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi -f
docker images | grep old | awk '{ print $1 " " $2 }' | while read LINE
do
IMAGE=$(echo $LINE | cut -d' ' -f1)
@cdpb
cdpb / make.sh
Last active November 5, 2016 12:22
Automatic Docker Build example
#!/bin/bash
set -e
while [[ $# > 0 ]]
do
case "$1" in
--folder)
shift
FOLDER="$1"