Skip to content

Instantly share code, notes, and snippets.

@xbalaji
Created September 19, 2017 14:57
Show Gist options
  • Save xbalaji/f5e63540f759ea6c56d9a0b3ce635ae3 to your computer and use it in GitHub Desktop.
Save xbalaji/f5e63540f759ea6c56d9a0b3ce635ae3 to your computer and use it in GitHub Desktop.
ansible training docker setup
# start the containers
docker run --name web1 -d -t ubuntu
docker run --name web2 -d -t ubuntu
docker run --name db1 -d -t ubuntu
# print the ip addresses of the containers
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' we b1
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' we b2
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' db 1
docker exec -i -t web1 /bin/bash
docker exec -i -t web2 /bin/bash
docker exec -i -t db1 /bin/bash
In each container run the following
apt -y update
apt -y upgrade
apt-get install -y python-minimal --no-install-recommends
python --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment