Access files on primary container from secondary container


#1

We have a ruby program that gets data from an upstream source as a CSV file then loads the contents into a postgres database using COPY. We have an rspec that tests this, and it works fine if the database is in the same container as the ruby, however fails if using a 2.0 style secondary container for postgres, I suppose because the CSV file is not present in the secondary container. Is there a way to allow access? I know that commands on secondary containers are not supported, but something like being able to mount a directory from primary on secondary would also work? I think the postgres ram-backed secondary container is significantly faster for our test suite (15mins vs 25mins) so I’m keen to use it if possible.


#2

You can run an initial command on a secondary container to start the database, maybe you could set something up there? I think you are right that you cannot send docker exec commands to the secondary container once it has started though.


#3

Ooooh thanks, hadn’t spotted that, will check it out!


#4

No worries. Check out this config reference, it is extremely handy.