Docker container missing library for oauth


Could you please add the python library “requests_oauthlib” to your container “”?
It is not installed by default:

root@d7b96e24d4cf:/opt/seafile# python3
Python 3.8.10 (default, Mar 13 2023, 10:26:41)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests_oauthlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'requests_oauthlib'

According to your documentation this is needed for OAuth to work: OAuth Authentication - Seafile Admin Manual

1 Like

Can you please take a look at this?

You could build your own docker image (based on the original image) and simply add the according lib there (in the following, apply the version accodingly to what you have in use).

Create a new folder and place a file named “Dockerfile” there. Paste these contents:

# Build image based on official seafile-mc version 10.0.1
FROM seafileltd/seafile-mc:10.0.1

# Add python libs and clear caches afterwards
RUN pip3 install --timeout=3600 requests requests_oauthlib \
    && rm -r /root/.cache/pip

# Nothing else required, everything else should be taken over from the parent image

I just put this together from what I found for the lib (so no guarantees), but you might get the idea: Use the existing base image and then use the pip3 command inside the image to add the library.

From that folder, run the following commands:

docker build --pull --rm -t my-seafile-mc-oauth:10.0.1 .

This will build your own docker image (using the above Dockerfile) named my-seafile-mc-oauth and versioned 10.0.1
You should then see that image on your machine with

docker images

Lastly, change your deployment to use my-seafile-mc-oauth:10.0.1 instead of the original seafileltd/seafile-mc:10.0.1

Thank you for your detailed post.

I know that I could just add it to my own container build. This however was not the motivation to post here.

In my opinion this library should be included in the stock container. The OAuth functionality is officially documented and supported. Therefore it also should work out of the box without modifying the container image myself.

There have been multiple requests to add this to the container image already:

And multiple forum posts mentioning it:

Can anybody from the Seafile team take a look?

We will give it a check in this week.

Thank you for your feedback. Since version 9.0, the requests_oauthlib has been included in the seafile and the seafile docker, does not need to be installed again.