Last active
May 6, 2018 04:20
-
-
Save trohit/d29af675325f1fe29382281477a12313 to your computer and use it in GitHub Desktop.
docker_khichdi
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
cat > /usr/local/bin/show_docker_ips | |
------------------------------------- | |
#/bin/bash | |
# shows the IPs of all the dockers on the host | |
# in a format that is accepted by /etc/hosts | |
for i in `docker ps|sed 1d|awk '{print $NF}'`; | |
do | |
DIP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $i) | |
echo "$DIP $i" | |
done | |
cat > /usr/local/bin/dip | |
------------------------ | |
#/bin/bash | |
# shows the ip corresponding to a docker name | |
#echo $i; | |
docker inspect --format '{{ .NetworkSettings.IPAddress }}' $1 | |
# to export a live docker | |
# https://blog.giantswarm.io/moving-docker-container-images-around/ | |
docker export CONTAINER_ID > container.tar | |
cat container.tar | docker import - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
docker aliases
https://kartar.net/2014/03/useful-docker-bash-functions-and-aliases/