docker links

7
Links

Upload: docker-inc

Post on 18-Nov-2014

93 views

Category:

Documents


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Docker Links

Links

Page 2: Docker Links

Why?

● Most containers only need to communicate with other containers

● Only expose the frontend to the public

Page 3: Docker Links

Stack

Todo MVCFlask python appRequires rethinkdbPublish port 5000

RethinkDBExpose port 27015Publish port 8080

Page 4: Docker Links

Environment

Links will expose the child container’s exposed ports, ip, and environment to the parent.

Environment vars are prefixed with the alias of the child i.e.

DB_PORT_27015_TCP=tcp://xxx.x...:27015

Page 5: Docker Links

Starting Rethinkdbdocker run -d -p 8080 -name rethinkdb -e NAME=todo crosbymichael/rethinkdb --bind all

Publish the admin ui to the host, keep everything else internally.0.0.0.0:49155->8080/tcp, 28015/tcp, 29015/tcp

Page 6: Docker Links

Starting the frontend

docker run -d -p 5000 -link rethinkdb:db -name todo frontend

#python code using a client libproto, ip, port = docker.require_port('db', 28015)database_name = docker.require_env('db', 'name')

Page 7: Docker Links

Codegithub.com/crosbymichael/docker-links-backbone-todo