Created
September 23, 2015 16:00
-
-
Save ds0nt/58694c89f93f0f6a18bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o nounset | |
set -o errexit | |
## Base Image Prompt | |
printOfficialImages() | |
{ | |
echo "Official Images: aerospike alpine arangodb buildpack-deps busybox cassandra celery centos cirros clojure couchbase crate crux debian django docker docker-dev drupal elasticsearch fedora gazebo gcc ghost glassfish golang haproxy haskell hello-world hipache httpd hylang iojs irssi java jenkins jetty joomla jruby julia kaazing-gateway kibana logstash mageia mariadb maven memcached mongo mono mysql nats neurodebian nginx node odoo opensuse oraclelinux owncloud percona perl php php-zendserver postgres pypy python r-base rabbitmq rails rakudo-star redis redmine registry rethinkdb rocket.chat ros ruby sentry sonarqube swarm thrift tomcat ubuntu ubuntu-debootstrap ubuntu-upstart websphere-liberty wordpress" | |
} | |
printLocalImages() | |
{ | |
echo -n "Local Images: " | |
docker images | cut -d\ -f1 | grep -Eo "^[^<].*" | xargs echo | cut -d\ -f2- | |
} | |
echo -n "Name for Image: " | |
read name | |
printOfficialImages | |
printLocalImages | |
echo -n "Base Image: " | |
read image | |
name="--name=\"${name:-`uuidgen`}\"" | |
cmdlog=`mktemp` | |
grep "$name" >(printLocalImages) && echo "WARN: image already exists"; | |
# run container from image.......docker stdout -> match to file | |
docker run -it $name $image bash | tee >(cat - | grep -Eo "[# ].*" | cut -c 3- >> $cmdlog) | |
docker commit -m "$cmdlog `date -I`" -a "$USER" $name | read cid | |
# mv $cmdlog "./$newimage.log" | |
# docker rename "$newimage" "$name" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment