Last active
December 23, 2015 00:59
-
-
Save crosbymichael/6557161 to your computer and use it in GitHub Desktop.
Docker links
This file contains hidden or 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
REDIS=$(docker run -d crosbymichael/redis) | |
docker run -link $REDIS:6379:redis -t -i 71cba4d74d62 bash | |
root@7c1879d423b6:/# cat app.py | |
import docker | |
from redis import Redis | |
ip, port = docker.require('redis') | |
r = Redis(host=ip, port=int(port)) | |
r.set('crosbymichael', 'Is amazing') | |
print r.get('crosbymichael') | |
root@7c1879d423b6:/# python app.py | |
Is amazing | |
root@7c1879d423b6:/# exit | |
docker link $REDIS | |
FROM TO ADDRESS ALIAS | |
52050b536cb6 7c1879d423b6 172.17.0.2:6379 redis |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment