0

I have multiple containers which run windows console applications in centOS, which create report files and i can access the output files in host server via volumes specified in docker-compose.yml

report_output:
    image: report:latest
    ports: ["80:80"]
    container_name: profit_report
    restart: always
    volumes:
     - /home/profit_report/:/app/report_output

I am writing another C# console application delete_report which deletes reports older than 2 years. If I add C# code to access path /home/profit_report/ in the new console, will it be able to access the path from the inside container "delete_report"?

Or how can i access the path /app/report_output of report_output container from delete_report container to delete the files directly inside the container.

Is connecting to host server path from container efficient way of doing this or is it efficient connecting to required container and access path inside?

All of the containers are binded in same network.

1
  • This sounds like you have a heavily file-based application; you don't want containers' filesystems to be isolated from the host system's or from each other's. Would it make more sense to run these applications directly on the host? Commented Apr 23, 2021 at 10:29

1 Answer 1

1

The compose config:

volumes:
     - /home/profit_report/:/app/report_output

Tells us, that folder

/home/profit_report

will be mounted in container(s), it means that any manipulation in it, also applied in container(s) with this mount, because it is just a mounting.

Therefore, you can create another container with same mounting and manipulate the files as you want.

So you delete report app, can be containered with mount like this:

volumes:
         - /home/profit_report/:/app/report_to_delete (or any path that you want)

And inside this container you just need to get files from mount path (/app/report_to_delete)

Sign up to request clarification or add additional context in comments.

2 Comments

+1 for the suggestion.... does it mean, I cant access report_output container folder/files from the inside of delete_report container ? just wanted to confirm before i make code changes to docket-compose.yml to add volumes of other containers in the delete_report service config section.
Yep, containers fully isolated from host and other containers (including FS) You always need to provide mount of folder\files\volumes\etc to grant access for container(s)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.