# Unable to run kolibri docker container with postgres container

**URL:** <https://community.learningequality.org/t/unable-to-run-kolibri-docker-container-with-postgres-container/2086>\
**Category:** Kolibri\
**Tags:** installation\
**Created:** [July 22, 2021, 2:06pm UTC](https://community.learningequality.org/t/unable-to-run-kolibri-docker-container-with-postgres-container/2086 "2021-07-22T14:06:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manish](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@Manish](https://community.learningequality.org/u/Manish)\
**Post date:** [July 22, 2021, 2:06pm UTC](https://community.learningequality.org/t/unable-to-run-kolibri-docker-container-with-postgres-container/2086/1 "2021-07-22T14:06:18Z")

</div>

Hi,

I am trying to connect kolibri container with postgresql container and getting an error as below

“sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedFunction) operator does not exist: character varying = integer  
LINE 3: …eduledjobs.queue = ‘kolibri’ AND scheduledjobs.id = 0) AS an…”  
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.

[SQL: SELECT EXISTS (SELECT 1  
FROM scheduledjobs  
WHERE scheduledjobs.queue = %(queue\_1)s AND scheduledjobs.id = %(id\_1)s) AS anon\_1]  
The environment variable related to postgres are overridden in entrypoint.py file.

## Technical details

- Version: 15
- OS: Linux (GCP VM)

Could you please suggest what is missing?  
I have connected kolibri with postgres without container and it worked fine.

Best Regards,  
Manish Deshmukh

---

<div class="post-metadata">

**Author:** ![richard](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/richard/32/10_2.png) [@richard](https://community.learningequality.org/u/richard)\
**Post date:** [July 22, 2021, 3:48pm UTC](https://community.learningequality.org/t/unable-to-run-kolibri-docker-container-with-postgres-container/2086/2 "2021-07-22T15:48:05Z")

</div>

This is on the develop branch?

Does the same setup work on 0.14?

I ask, as my first guess is that this might be a bug related to updates to the task system in the develop branch.

I assume you are setting the following environment variables:

```auto
KOLIBRI_DATABASE_ENGINE - Which database backend to use, choices are 'sqlite' or 'postgresql'

KOLIBRI_DATABASE_NAME - 
                For SQLite - the name of a database file to use for the main Kolibri database.
                For Postgresql, the name of the database to use for all Kolibri data.
            

KOLIBRI_DATABASE_PORT - The port on which to connect to the database, Postgresql only.

KOLIBRI_DATABASE_PASSWORD - The password to authenticate with when connecting to the database, Postgresql only.

KOLIBRI_DATABASE_HOST - The host on which to connect to the database, Postgresql only.

KOLIBRI_DATABASE_USER - The user to authenticate with when connecting to the database, Postgresql only.

```

---

<div class="post-metadata">

**Author:** ![Manish](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@Manish](https://community.learningequality.org/u/Manish)\
**Post date:** [July 23, 2021, 3:12am UTC](https://community.learningequality.org/t/unable-to-run-kolibri-docker-container-with-postgres-container/2086/3 "2021-07-23T03:12:46Z")

</div>

Hi Richard,

Thanks, Yes I am setting up those environment variables. However the value “postgresql” against KOLIBRI\_DATABASE\_ENGINE throws an error so I have used “prostgres”, and assume that does not relate with the issue.  
Version 0.14 also throws same error. I shall try 0.13 today to see if that works.

Best Regards,  
Manish Deshmukh

---

<div class="post-metadata">

**Author:** ![aronasorman](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/aronasorman/32/443_2.png) [@aronasorman](https://community.learningequality.org/u/aronasorman)\
**Post date:** [July 23, 2021, 2:47pm UTC](https://community.learningequality.org/t/unable-to-run-kolibri-docker-container-with-postgres-container/2086/4 "2021-07-23T14:47:04Z")

</div>

Hi @Manish! Aron here, one of the infrastructure engineers for Learning Equality.

Do you know what the error is when you use `postgresql`? It may be attempting to connect but other issues may prevent it from connecting.

---

<div class="post-metadata">

**Author:** ![Manish](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@Manish](https://community.learningequality.org/u/Manish)\
**Post date:** [July 23, 2021, 4:36pm UTC](https://community.learningequality.org/t/unable-to-run-kolibri-docker-container-with-postgres-container/2086/5 "2021-07-23T16:36:23Z")

</div>

Hi Aron,

I get the following error:  
“ERROR Error processing environment variable option KOLIBRI\_DATABASE\_ENGINE: the value “postgresql” is unacceptable.  
CRITICAL Aborting: Could not process options config (see errors above for more details)  
error Command failed with exit code 1.”

Best Regards,  
Manish Deshmukh

---

<div class="post-metadata">

**Author:** ![richard](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/richard/32/10_2.png) [@richard](https://community.learningequality.org/u/richard)\
**Post date:** [July 23, 2021, 5:02pm UTC](https://community.learningequality.org/t/unable-to-run-kolibri-docker-container-with-postgres-container/2086/6 "2021-07-23T17:02:01Z")

</div>

This is expected - the allowed values are `sqlite` (the default) and `postgres`.

I think @aronasorman was looking for more detail of the error you saw when it was correctly configured though?

---

<div class="post-metadata">

**Author:** ![Manish](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@Manish](https://community.learningequality.org/u/Manish)\
**Post date:** [July 23, 2021, 5:15pm UTC](https://community.learningequality.org/t/unable-to-run-kolibri-docker-container-with-postgres-container/2086/7 "2021-07-23T17:15:57Z")

</div>

Hi Richard, Aron,

Apologies for the confusion and such a big message below.

Complete error message from the logs.

ERROR ENGINE Error in ‘start’ listener \<bound method ServicesPlugin.start of \<kolibri.utils.server.ServicesPlugin object at 0x7feff7a2f4e0\>\>  
Traceback (most recent call last):  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py”, line 1284, in \_execute\_context  
cursor, statement, parameters, context  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/default.py”, line 590, in do\_execute  
cursor.execute(statement, parameters)  
psycopg2.errors.UndefinedFunction: operator does not exist: character varying = integer  
LINE 3: …eduledjobs.queue = ‘kolibri’ AND scheduledjobs.id = 0) AS an…  
^  
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):  
File “/usr/local/lib/python3.6/dist-packages/cherrypy/process/wspbus.py”, line 230, in publish  
output.append(listener(\*args, \*\*kwargs))  
File “/kolibri/kolibri/utils/server.py”, line 93, in start  
if SCH\_PING\_JOB\_ID not in scheduler:  
File “/usr/local/lib/python3.6/dist-packages/django/utils/functional.py”, line 239, in inner  
return func(self.\_wrapped, \*args)  
_**File “/kolibri/kolibri/core/tasks/scheduler.py”, line 79, in contains  
self.\_ns\_query(session).filter\_by(id=job\_id).exists()**_  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/query.py”, line 3469, in scalar  
ret = self.one()  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/query.py”, line 3436, in one  
ret = self.one\_or\_none()  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/query.py”, line 3405, in one\_or\_none  
ret = list(self)  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/query.py”, line 3481, in **iter**  
return self.\_execute\_and\_instances(context)  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/query.py”, line 3506, in \_execute\_and\_instances  
result = conn.execute(querycontext.statement, self.\_params)  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py”, line 1020, in execute  
return meth(self, multiparams, params)  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/sql/elements.py”, line 298, in \_execute\_on\_connection  
return connection.\_execute\_clauseelement(self, multiparams, params)  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py”, line 1139, in \_execute\_clauseelement  
distilled\_params,  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py”, line 1324, in _execute\_context  
e, statement, parameters, cursor, context  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py”, line 1518, in handle\_dbapi\_exception  
sqlalchemy\_exception, with\_traceback=exc\_info[2], from=e  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/compat.py”, line 178, in raise_  
raise exception  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py”, line 1284, in \_execute\_context  
cursor, statement, parameters, context  
File “/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/default.py”, line 590, in do\_execute  
cursor.execute(statement, parameters)  
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedFunction) operator does not exist: character varying = integer  
LINE 3: …eduledjobs.queue = ‘kolibri’ AND scheduledjobs.id = 0) AS an…  
^  
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.

[SQL: SELECT EXISTS (SELECT 1  
FROM scheduledjobs  
WHERE scheduledjobs.queue = %(queue\_1)s AND scheduledjobs.id = %(id\_1)s) AS anon\_1]  
(Background on this error at: [Error Messages — SQLAlchemy 1.4 Documentation](http://sqlalche.me/e/f405))

INFO ENGINE Started monitor thread ‘Autoreloader’.  
INFO ENGINE Serving on [http://0.0.0.0:8000](http://0.0.0.0:8000)  
INFO ENGINE Serving on [http://0.0.0.0:8888](http://0.0.0.0:8888)  
ERROR ENGINE Shutting down due to error in start listener:  
Traceback (most recent call last):  
File “/usr/local/lib/python3.6/dist-packages/cherrypy/process/wspbus.py”, line 268, in start  
self.publish(‘start’)  
File “/usr/local/lib/python3.6/dist-packages/cherrypy/process/wspbus.py”, line 248, in publish  
raise exc  
cherrypy.process.wspbus.ChannelFailures: ProgrammingError("(psycopg2.errors.UndefinedFunction) operator does not exist: character varying = integer\nLINE 3: …eduledjobs.queue = ‘kolibri’ AND scheduledjobs.id = 0) AS an…\n ^\nHINT: No operator matches the given name and argument types. You might need to add explicit type casts.\n",)

INFO ENGINE Bus STOPPING  
INFO ENGINE HTTP Server cherrypy.\_cpwsgi\_server.CPWSGIServer((‘0.0.0.0’, 8000)) shut down  
INFO ENGINE HTTP Server cheroot.wsgi.Server((‘0.0.0.0’, 8888)) shut down  
INFO ENGINE Stopped thread ‘Autoreloader’.  
INFO ENGINE Bus STOPPED  
INFO ENGINE Bus EXITING  
INFO ENGINE Bus EXITED  
error Command failed with exit code 70.

Best Regards,  
Manish Deshmukh

---

<div class="post-metadata">

**Author:** ![richard](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/richard/32/10_2.png) [@richard](https://community.learningequality.org/u/richard)\
**Post date:** [July 23, 2021, 5:26pm UTC](https://community.learningequality.org/t/unable-to-run-kolibri-docker-container-with-postgres-container/2086/8 "2021-07-23T17:26:19Z")

</div>

Is this with latest develop? This bug appears to be the result of a job id being set to an integer rather than a string, but that was fixed in this PR: [tests: ensure jobs persist on server restart by vkWeb · Pull Request #8030 · learningequality/kolibri · GitHub](https://github.com/learningequality/kolibri/pull/8030)

---

<div class="post-metadata">

**Author:** ![Manish](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@Manish](https://community.learningequality.org/u/Manish)\
**Post date:** [July 23, 2021, 8:44pm UTC](https://community.learningequality.org/t/unable-to-run-kolibri-docker-container-with-postgres-container/2086/9 "2021-07-23T20:44:41Z")

</div>

Hi Richard,

Many thanks!! I wasn’t using the latest 😞. The latest one works fine. I am greatful for you and Aron for swift responses.

Best Regards,  
Manish Deshmukh
