question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem adding documents when using Meilisearch in a Python Docker Container

See original GitHub issue

Description I have built a python application that I need to run in a Docker Container. It gathers data, adds it to a CSV, then adds it to Meilisearch using the Meilisearch module.

Expected behavior Add CSV to database/Meilisearch and finish the code.

Current behavior Program ran like normal until it was time to delete the index like I would want. It runs perfect just running with python main.py but for some reason, in packaged in a Docker Container it fails.

Environment (please complete the following information):

  • OS: Debian Linux
  • Meilisearch version: Latest
  • meilisearch-python version: Latest

Really simple docker file:

FROM python:3.9-slim
COPY . .
RUN pip install -r requirements.txt
ENV CRONMONITORING=healthchecksurl
ENV SEARCHCLIENT=meiliclient
ENV SEARCHCLIENTKEY=meiliclientapikey
CMD ["python", "main.py"]

Really simple usage of Meilisearch:

client = meilisearch.Client(SEARCHCLIENT, SEARCHCLIENTKEY)
index = client.index('index')
csvfile = open('index.csv', 'r')
data = csvfile.read()
index.delete_all_documents()
index.add_documents_csv(data.encode('utf-8'))

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
Wamy-Devcommented, Oct 22, 2022

Ah, instead of doing that, I ran the container privileged using the --privileged tag, when running the container, and it seemed to have worked. I’m going to change the title as it will be more relevant for newcomers. Thank you for your help. Seems like memory was really the problem.

0reactions
sanders41commented, Oct 22, 2022

The Meilisearch client in and out of Docker should act the same. I wonder if it is a memory issue since the Docker container will have less available to it than outside Docker. If you try the encoding without sending to Meilisearch does it error?

csvfile = open('index.csv', 'r')
data = csvfile.read()
data.encode('utf-8')
Read more comments on GitHub >

github_iconTop Results From Across the Web

Changes regarding Meilisearch v0.27.0 · Issue #190 - GitHub
This issue gathers the changes related to the v0.27.0 of Meilisearch that will impact the integrations. Release date: 09/05/2022.
Read more >
Quick start | Meilisearch Documentation v0.30
This quick start will walk you through setting up Meilisearch, adding documents, performing your first search, using the search preview, adding a search...
Read more >
Using Meilisearch with Docker
In this guide you will learn how to use Docker to download and run Meilisearch, configure its behavior, and manage your Meilisearch data....
Read more >
Run Meilisearch in production: taking it to the next level
Running a Meilisearch instance for testing purposes is incredibly easy and can be done in many ways: using Docker, Homebrew, Aptitude, binaries, a...
Read more >
Documents | Meilisearch Documentation v0.30
Documents function as containers for organizing data, and are the basic building blocks of a Meilisearch database. To search for a document, you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found