Directory sharing does not work with docker

Hello,
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. Only the dhis.conf file is allowed to be shared between host and centenaire with the link ./DHIS2_home/dhis.conf:/opt /dhis2/dhis.conf . As you know, files and applications uploaded to dhis2 are stored in these folders. Any loss of centenaries automatically results in the loss of these files and applications, which is not acceptable. So I have some questions:

  1. Why did you prevent the sharing of the “files” and “logs” folders from version 2.38 onwards?
  2. Is there any other way to share the contents of these folders from the centennial to the host
  3. Do you advise against using docker images in production?
  4. Does using docker images reduce the performance of DHIS2?
    Note that for the past few years we have been using docker images for all our dhis2 deployments and we really haven’t encountered any problems. Some instances are very busy and have a large data size.
    Thanks

From a few sources which I have read, I may not have concrete answers but the development team might need to come in and help us all on your topic. I once faced this similar approach. Here is what I read

  1. Why did DHIS2 prevent the sharing of the “files” and “logs” folders from version 2.38 onwards?
    The decision to restrict sharing of the “files” and “logs” folders might have been made for security or performance reasons. By limiting the sharing of these folders, DHIS2 can enforce better control and isolation of critical data and logs, reducing potential security risks and ensuring proper management of log files.

  2. Is there any other way to share the contents of these folders from the centenaire to the host?
    If the sharing of the “files” and “logs” folders is restricted, you may need to explore alternative methods for accessing the contents of these folders. One possible approach could be to set up scheduled backups or data export processes within the Docker container to regularly transfer the necessary files to a location outside the container, such as a separate network storage solution or a different host. This would help ensure data integrity and provide a backup mechanism in case of centenary loss.

  3. Do you advise against using Docker images in production?
    Docker can be a useful tool for deploying and managing DHIS2 instances, and many organizations successfully use Docker in production environments. However, it’s essential to follow best practices and ensure proper configuration and maintenance of the Docker setup. This includes regular backups, monitoring, security considerations, and keeping up with updates and patches. It’s recommended to consult the DHIS2 documentation and community resources for specific guidance on using Docker in production.

  4. Does using Docker images reduce the performance of DHIS2?
    When properly configured and optimized, Docker should not significantly impact the performance of DHIS2. However, Docker introduces an additional layer of virtualization and resource management, which may have a slight impact on performance compared to running DHIS2 directly on the host. It’s crucial to allocate appropriate resources (CPU, memory, storage) to the Docker containers and monitor performance to ensure optimal operation.

Please keep in mind that the above responses are general in nature, and for precise details and guidance regarding DHIS2 and Docker usage we might need dive deep on this one.

2 Likes

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