Skip to content

Instantly share code, notes, and snippets.

@trohit
Last active May 6, 2018 04:20
Show Gist options
  • Save trohit/d29af675325f1fe29382281477a12313 to your computer and use it in GitHub Desktop.
Save trohit/d29af675325f1fe29382281477a12313 to your computer and use it in GitHub Desktop.
docker_khichdi
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 -
@trohit
Copy link
Author

trohit commented Dec 26, 2016

@trohit
Copy link
Author

trohit commented May 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment