How can I access directories inside a docker container from outside (not the reverse!)?

HOW TO -️ October 18, 2021

I am trying to setup plug-and-play docker images for my development and support team members - however I am running into some problems because I want them to be able to use the editor of their choice!

There are two critical folders that are part of the build (eggs and src) that needs to be exposed to the end users so that they can edit it in any editor of their choice.

All the options to edit container files in host machine talks about mounting a fresh folder from the outside; but like I said, my src and egg folders are part of the build, so I can't let them mount a fresh folder during docker run.

I thought of about using volumes, but here are the questions I have on this approach:

1) Do we usually put build stuff that are actually part of the container into volumes? The container has no meaning without these volumes.

2) Can end users take a copy of these volumes and just modify it according to their convenience without the master copy of these volumes? (Like Image vs Container concept?)

All my problems will be solved if I can expose folders inside my container to the outside (not the reverse), but that seems really tricky to achieve!

PS: I haven't research enough on volumes but I thought I could ask this question anyway.


Just to complete the workflow, our development/support team usually identifies and fixes these problems in their machine, sends a PR to the Git system which then gets merged etc.

I am trying to use Docker to solve the problem of not re-building the entire web-app in each developers machine running multiple OSes etc.

Answer

Have a look at https://github.com/cweagans/docker-bg-sync. @HediNasr, interesting I will have a work - but I can't believe there are no better options than syncing :-) If it has 2-way syncing it might work, but I am looking for better options.

Initializing...