Giving Orthanc in Docker Container Ownership of Folder

Hi, I’m trying to change the location in which Orthanc stores its DICOM files, but from my understanding Orthanc needs to have access to that folder to do so. The folder I want to store the DICOMs in is on a different drive and not the main one, but I’m having issues trying to give ownership over so that it can start using that folder to store the DICOM files rather than the default location. I’m also using the PostgreSQL plugin if that makes any difference. Thank you.

I forgot to mention that I’m using Linux.


This is more a Docker question than an Orthanc question, so you might get more information from another forum.

Anyway, I guess you should have a look at the “–user” option of Docker:

For instance:

$ docker run --user $(id -u):$(id -g) […other options, including “-v” to map the folder…]


Hello TM,

I have my Orthanc docker containers saving to external partitions by way of --volume shares and the --user option that Sebastien mentioned.

Whether it is necessary, I also go an additional step and derive my own docker image with a special UID/GID user/group (by way of useradd commands in the image build) that is shared between the docker and host machine. I make the UID/GID owner of the folders hosted on the external machine and use the UID/GID in the --user option.

In my Dockerfile for creating a derived image with UID/GID:

RUN groupadd -r orthancuser -g #### &&
useradd -u #### -r -c “Docker Image User” -g orthancuser orthancuser

where #### corresponds to the UID/GID I also created on the host and made owner of the host folders.

You may find that at run time, when using the --user option, your chosen UID/GID will not have access to folders belonging to root and used to launch the Orthanc process inside the container. I add the following to make sure the new UID/GID has access:

RUN chown -R ####:#### /usr/share/orthanc /etc/orthanc /usr/lib/orthanc

where, again, #### is your chosen UID/GID set of IDs.

I’ve only recently started testing the new 1.9.4 Docker images. The above commands may need updating.