Recently, when updating the OneDrive client for Linux, I followed the instructions and encountered this error:
permission denied open config in w mode
- Simple Version
Run the container once as root, and after updating the directory permissions, you can run it as the onedrive user. - Detailed Version
At first glance, it seems that the directory permissions in the container are incorrect, because there was another message before this error:
change owner of /onedrive/data to onedrive:onedrive with gosu
Then I entered using the override entrypoint mode (the default entrypoint.sh keeps restarting):
docker run --entrypoint sh -it driveone/onedrive:edge
Sure enough, I found that /onedrive/data is root, and my first reaction was to start the container as root:
docker run -it --name onedrive -v onedrive_conf:/onedrive/conf \
-v "${ONEDRIVE_DATA_DIR}:/onedrive/data" \
-e "ONEDRIVE_UID=${ONEDRIVE_UID}" \
-e "ONEDRIVE_GID=${ONEDRIVE_GID}" \
-e "ONEDRIVE_RUNAS_ROOT=1" \
driveone/onedrive:edge
It worked as expected.
Then I discovered a second issue: newly created local files and directories have root permissions, making them inaccessible to the user.
At this point, the directory permissions in the container were already correct, so I could run docker as the onedrive user:
docker run -it --name onedrive -v onedrive_conf:/onedrive/conf \
-v "${ONEDRIVE_DATA_DIR}:/onedrive/data" \
-e "ONEDRIVE_UID=${ONEDRIVE_UID}" \
-e "ONEDRIVE_GID=${ONEDRIVE_GID}" \
driveone/onedrive:edge