How to seed a DB for a docker stack

http://community.cloud66.com/articles/seeding-your-database

This doesn’t cover docker stacks. What’s the best way to seed a db for a docker stack?

Hi Nadav!

You can use a build_command to run that - these will run on your host directly, running inside a temporary container created for the command. This should allow you to seed your database.

Philip

Actually, I see that you want to run the command outside of the container. You will be able to do this with a deploy hook soon, but in the meantime I’d suggest that you run it manually on the host for a one-off command like this. Please note that the server won’t have PSQL packages though, so perhaps it’s better if you run it inside your container.

I’ll just run it on the PostgreSQL server for now. It should have the psql package as well.

Thanks!

You must be logged in to answer this question