Reputation: 11
I am new to docker compose and can’t figure out how to customize my images from private/public docker hub, before it starts with compose.
The final purpose is to have standard images on hub, which are called by compose and customize on the fly with one configuration file stored locally (containing password, IP, private info).
In more detail, I got a DB postgres, and a backend(django app) linked to it.
Everything is working fine if I do step by step, get the images, run each one as container and add the customization. And finally run one last time the containers DB and backend with the link.
With compose, as the whole thing is ran all togever once, I can’t seem to be able to customize correctly the backend (copy one file) before the container ran and is linked to the db. I can run customization after docker compose up, but seems that it’s too late.
Anyone could give me a tip how to make it work? Or what's the best approach for this process.
Thank you for your precious help. Very good evening!
Regards, Greg.
Upvotes: 0
Views: 706
Reputation: 12090
The backend need a config file added to a repertory inside that container before the app could work.
Why don't you use VOLUME to mount that file to the container. Docker compose supports the volumes:
as standard syntax.
Alternatively, you can locally build that image, with that file via Dockerfile and push that image to hub. Then you can directly use your image, as if you you are using the standard image.
Upvotes: 1