Directory sharing does not work with docker

Hi :smile:

We have noticed some restrictions on the share folder of dockers centenaries from version 2.38. Indeed, the folders “files” and “logs” are no more shared with host through volumes.

I assume you are talking/using the d2 CLI, right?

The DHIS2 Docker images do not restrict you to log to files. They also do not restrict you to store your logs, apps, files into a persistent storage. By persistent storage I mean a place that will not be removed when the container is removed.

You can configure the logging library in any way you want like logging to files or stdout. We decided to log to stdout instead of files for d2 and other container based DHIS2 projects as this is best practice in containerized environments. Logs are usually forwarded to a centralized logging backend like elasticsearch for searching. For development for which d2 is made we don’t see the point of cluttering up anyone’s disk with logs they do not want to keep. As said you can change that if you want to :ok_hand:

  1. Why did you prevent the sharing of the “files” and “logs” folders from version 2.38 onwards?

The details of why are discussed in D2 cluster changes: feedback needed on files added to DHIS2_HOME

The apps, files are still stored in a volume. So starting and stopping the container should not delete those. If you remove the volume the data is gone, that is correct. d2 is a wrapper of docker compose so you can enable --debug in d2 and see what it executes. The docker compose docs docker compose down | Docker Docs then specify whether the particular command will delete a volume or not. Feel free to post your workflow and we can help you :smile:

  1. Is there any other way to share the contents of these folders from the centennial to the host

d2 is a wrapper of docker compose using d2-cluster-docker-compose/cluster/docker-compose.yml at master · dhis2/d2-cluster-docker-compose · GitHub. You can use it or dhis2-core docker-compose.yml as a base to creating a docker compose file that suits your needs best.

  1. Do you advise against using Docker images in production?

Copied from Docker

We cannot recommend the images for use in production. At this point we don’t have enough experience and therefore can’t vouch for their stability for “mission critical” production use. We are not saying that someone experienced with running Docker in production shouldn’t use them. In other words, anyone deciding to use DHIS2 in Docker should be aware that they are doing so at their own risk. If you decide to go for it, make sure you perform enough security, performance and stress testing.

I hope this clarifies your questions. Let us know if anything is still unclear :smile:

2 Likes