Sorry for disappearing. I had to check my “unread” list to find the topic again.
I don’t know what that “links” folder is. Everything depends on the exact usecase. Windows has different way to manage permissions, so when you mount a folder from the host, that folder is world writable from the container. I didn’t remember what happens when you create a file from the container in the mounted folder, so I tried now, and I could edit it from the host. This is again not something that would work everywhere, but at least you don’t have to write a basically system folder.
On linux, you culd make the files writable by a group, so even if the owner is for example UID 33 (usually www-data), but the group is GID 1000 (on linux it is the main group of the first user), the group could write the files so your user could write the files.
I already gave you an idea how you could generate a yaml when the container starts, but if you need a whole folder, then you
- need proper permissions, groups, ownerships
- save everything on a volume which you can mount in an other container which could run an FTP or a samba server. If you choose to run a samba server, you could mount the volume as a shared folder on Windows if you could configure it properly.
These are not always easy solutions, but working with containers is not always easy it just helps a lot when you know enough to get through these issues.
I never edit anything generated in containers. If I need it for debugging, I I set the permissions manually or do it as root from the container.
An other idea is using a container as development environment. Visual Studio Code can use a container as a remote host, run a small server component in the container so you can connect to it from VSCode and work as if it were your local machine. You can even use the terminal and every GUI feature like browsing and editing files.
Let’s say you run “blackbox” as the container that runs your application. “blackbox” has a “data” (or links??) volume so everything is on a Linux filesystem. You want to edit files on that volume, so you run a “devenv” container like:
devenv:
image: bash
volumes:
- data:/app/data
user: 33
init: true
command:
- sleep
- inf
run visual studio code, choose “Remote Explorer”, then “containers” and open
“/app” in the devenv container. If you run the devenv container as the same user that generates files in the blackbox container, you can edit those files.
Now I didn’t try it so my above compose file example can be wrong, but something similar should work. I created a quick screenshot.
I ran only one container as an example without compose, but compose would just make it easier.
Or you could use the “official” Dev environment provided by Docker in Docker Desktop, but that is for an other purpose, although the idea is the same. Working on a Non-Linux environment and still using Linux as a light weight development environment.
Note that you still need to set file and folder permissions if you want to edit files created by different users.