I linked my app container to postgres on run
:
docker run --link postgres:postgres someproject/develop
and it worked fine.
I got the answer from the docker contributor Brian Goff:
docker run -d --name mydb postgres
docker run --rm --link mydb:db myrailsapp rake db:migrate
docker run -d --name myapp --link mydb:db myrailsapp
This is going to fire up postgres. Fire up a container which does the db migration and immediately exits and removes itself. Fires up the rails app.
Think of the build process like compiling an application. You don't seed data into a database as part of the compilation phase.