{"id":20528293,"url":"https://github.com/manticoresoftware/docker","last_synced_at":"2025-04-06T18:17:10.250Z","repository":{"id":28686552,"uuid":"118498743","full_name":"manticoresoftware/docker","owner":"manticoresoftware","description":"Official docker for Manticore Search","archived":false,"fork":false,"pushed_at":"2025-01-11T14:04:20.000Z","size":36394,"stargazers_count":68,"open_issues_count":8,"forks_count":20,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-01-21T08:22:35.585Z","etag":null,"topics":["docker-image","manticore-search","manticoresearch","search-engine","sphinxsearch"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manticoresoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-22T18:38:58.000Z","updated_at":"2025-01-11T14:04:22.000Z","dependencies_parsed_at":"2023-10-21T16:33:58.164Z","dependency_job_id":"f267adc9-bdc5-44a6-9abe-05b42bd42e30","html_url":"https://github.com/manticoresoftware/docker","commit_stats":null,"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manticoresoftware%2Fdocker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manticoresoftware%2Fdocker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manticoresoftware%2Fdocker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manticoresoftware%2Fdocker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manticoresoftware","download_url":"https://codeload.github.com/manticoresoftware/docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247526768,"owners_count":20953143,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-image","manticore-search","manticoresearch","search-engine","sphinxsearch"],"created_at":"2024-11-15T23:24:23.098Z","updated_at":"2025-04-06T18:17:10.228Z","avatar_url":"https://github.com/manticoresoftware.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Manticore Search Docker image\n\nThis is the git repo of official [Docker image](https://hub.docker.com/r/manticoresearch/manticore/) for [Manticore Search](https://github.com/manticoresoftware/manticoresearch).\n\n❗ Please note: This is a development version repo. For the latest release's information, refer to the readme at https://github.com/manticoresoftware/docker/tree/docker-9.2.14\n\nManticore Search is an easy to use open source fast database for search. It helps thousands of companies from small to large, such as Craigslist, to search and filter petabytes of text data on a single or hundreds of nodes, do stream full-text filtering, add auto-complete, spell correction, more-like-this, faceting and other search-related technologies to their websites and applications.\n\nThe default configuration includes a sample Real-Time index and listens on the default ports:\n  * `9306` for connections from a MySQL client\n  * `9308` for connections via HTTP\n  * `9312` for connections via a binary protocol (e.g. in case you run a cluster)\n\nThe image comes with libraries for easy indexing data from MySQL, PostgreSQL XML and CSV files.\n\n# How to run Manticore Search Docker image\n\n## Quick usage\n\nThe below is the simplest way to start Manticore in a container and log in to it via the mysql client:\n\n```bash\ndocker run --name manticore --rm -d manticoresearch/manticore \u0026\u0026 echo \"Waiting for Manticore docker to start. Consider mapping the data_dir to make it start faster next time\" \u0026\u0026 until docker logs manticore 2\u003e\u00261 | grep -q \"accepting connections\"; do sleep 1; echo -n .; done \u0026\u0026 echo \u0026\u0026 docker exec -it manticore mysql \u0026\u0026 docker stop manticore\n```\n\nNote that upon exiting the MySQL client, the Manticore container will be stopped and removed, resulting in no saved data. For information on using Manticore in a production environment, please see below.\n\nThe image comes with a sample table that can be loaded like this:\n\n```sql\nmysql\u003e source /sandbox.sql\n```\n\nAlso, the mysql client has several sample queries in its history that you can run on the above table, just use Up/Down keys in the client to see and run them.\n\n## Production use\n\n\n### Ports and mounting points\n\nFor data persistence the folder `/var/lib/manticore/` should be mounted to local storage or other desired storage engine.\n\nThe configuration file within the instance can be found at `/etc/manticoresearch/manticore.conf`. To apply custom settings, ensure that this file is mounted to your own configuration file. Additionally, configuration parameters can be set [through environment variables](#configuring-manticore-search-with-docker).\n\nIt is **important to note** that configuring certain parameters through environment variables takes precedence. \nFor example, if you set `-e searchd_listen='19306:mysql'` via environments and concurrently include `listen = 9306:mysql` in the configuration, the search functionality will ultimately listen on port `19306` for SQL connections.\n\nThe ports are 9306/9308/9312 for SQL/HTTP/Binary, expose them depending on how you are going to use Manticore. For example:\n\n```bash\ndocker run --name manticore -v $(pwd)/data:/var/lib/manticore -p 127.0.0.1:9306:9306 -p 127.0.0.1:9308:9308 -d manticoresearch/manticore\n```\n\nor\n\n```bash\ndocker run --name manticore -v $(pwd)/manticore.conf:/etc/manticoresearch/manticore.conf -v $(pwd)/data:/var/lib/manticore/ -p 127.0.0.1:9306:9306 -p 127.0.0.1:9308:9308 -d manticoresearch/manticore\n```\n\nMake sure to remove `127.0.0.1:` if you want the ports to be available for external hosts.\n\n\nThe Manticore Search Docker image comes with pre-installed [Manticore Columnar Library](https://github.com/manticoresoftware/columnar) and [Manticore Buddy](https://github.com/manticoresoftware/manticoresearch-buddy)\n\n### Docker-compose\n\nIn many cases, you may want to use Manticore in conjunction with other images specified in a Docker Compose YAML file. Below is the minimal recommended configuration for Manticore Search in a docker-compose.yml file:\n\n```yaml\nversion: '2.2'\n\nservices:\n  manticore:\n    container_name: manticore\n    image: manticoresearch/manticore\n    restart: always\n    ports:\n      - 127.0.0.1:9306:9306\n      - 127.0.0.1:9308:9308\n    ulimits:\n      nproc: 65535\n      nofile:\n         soft: 65535\n         hard: 65535\n      memlock:\n        soft: -1\n        hard: -1\n    volumes:\n      - ./data:/var/lib/manticore\n#      - ./manticore.conf:/etc/manticoresearch/manticore.conf # uncomment if you use a custom config\n```\n\nBesides using the exposed ports 9306 and 9308, you can log into the instance by running `docker-compose exec manticore mysql`.\n\n### HTTP protocol\n\nHTTP protocol is exposed on port 9308. You can map the port locally and connect using curl.:\n\n```bash\ndocker run --name manticore -p 9308:9308 -d manticoresearch/manticore\n```\n\n\u003c!-- example create --\u003e\nCreate a table:\n\n\u003c!-- request JSON --\u003e\n```bash\ncurl -X POST 'http://127.0.0.1:9308/sql' -d 'mode=raw\u0026query=CREATE TABLE testrt ( title text, content text, gid integer)'\n```\n\u003c!-- end --\u003e\n\u003c!-- example insert --\u003e\nInsert a document:\n\n\u003c!-- request JSON --\u003e\n```bash\ncurl -X POST 'http://127.0.0.1:9308/json/insert' -d'{\"index\":\"testrt\",\"id\":1,\"doc\":{\"title\":\"Hello\",\"content\":\"world\",\"gid\":1}}'\n```\n\u003c!-- end --\u003e\n\u003c!-- example search --\u003e\nPerform a simple search:\n\n\u003c!-- request JSON --\u003e\n```bash\ncurl -X POST 'http://127.0.0.1:9308/json/search' -d '{\"index\":\"testrt\",\"query\":{\"match\":{\"*\":\"hello world\"}}}'\n```\n\u003c!-- end --\u003e\n\n### Logging\n\nBy default, the server is set to send its logging to `/dev/stdout`, which can be viewed from the host with:\n\n\n```bash\ndocker logs manticore\n```\n\nThe query log can be diverted to Docker log by passing the variable `QUERY_LOG_TO_STDOUT=true`.\n\n\n### Multi-node cluster with replication\n\nHere is a simple `docker-compose.yml` for defining a two node cluster:\n\n```yaml\nversion: '2.2'\n\nservices:\n\n  manticore-1:\n    image: manticoresearch/manticore\n    restart: always\n    ulimits:\n      nproc: 65535\n      nofile:\n         soft: 65535\n         hard: 65535\n      memlock:\n        soft: -1\n        hard: -1\n    networks:\n      - manticore\n  manticore-2:\n    image: manticoresearch/manticore\n    restart: always\n    ulimits:\n      nproc: 65535\n      nofile:\n        soft: 65535\n        hard: 65535\n      memlock:\n        soft: -1\n        hard: -1\n    networks:\n      - manticore\nnetworks:\n  manticore:\n    driver: bridge\n```\n* Start it: `docker-compose up`\n* Create a cluster:\n  ```sql\n  $ docker-compose exec manticore-1 mysql\n\n  mysql\u003e CREATE TABLE testrt ( title text, content text, gid integer);\n\n  mysql\u003e CREATE CLUSTER posts;\n  Query OK, 0 rows affected (0.24 sec)\n\n  mysql\u003e ALTER CLUSTER posts ADD testrt;\n  Query OK, 0 rows affected (0.07 sec)\n\n  MySQL [(none)]\u003e exit\n  Bye\n  ```\n* Join to the the cluster on the 2nd instance\n  ```sql\n  $ docker-compose exec manticore-2 mysql\n\n  mysql\u003e JOIN CLUSTER posts AT 'manticore-1:9312';\n  mysql\u003e INSERT INTO posts:testrt(title,content,gid)  VALUES('hello','world',1);\n  Query OK, 1 row affected (0.00 sec)\n\n  MySQL [(none)]\u003e exit\n  Bye\n  ```\n* If you now go back to the first instance you'll see the new record:\n  ```sql\n  $ docker-compose exec manticore-1 mysql\n\n  MySQL [(none)]\u003e select * from testrt;\n  +---------------------+------+-------+---------+\n  | id                  | gid  | title | content |\n  +---------------------+------+-------+---------+\n  | 3891565839006040065 |    1 | hello | world   |\n  +---------------------+------+-------+---------+\n  1 row in set (0.00 sec)\n\n  MySQL [(none)]\u003e exit\n  Bye\n  ```\n\n## Memory locking and limits\n\nIt's recommended to overwrite the default ulimits of docker for the Manticore instance:\n\n```bash\n --ulimit nofile=65536:65536\n```\n\nFor best performance, table components can be \"mlocked\" into memory. When Manticore is run under Docker, the instance requires additional privileges to allow memory locking. The following options must be added when running the instance:\n\n```bash\n  --cap-add=IPC_LOCK --ulimit memlock=-1:-1\n```\n\n## Configuring Manticore Search with Docker\n\nIf you want to run Manticore with a custom configuration that includes table definitions, you will need to mount the configuration to the instance:\n\n```bash\ndocker run --name manticore -v $(pwd)/manticore.conf:/etc/manticoresearch/manticore.conf -v $(pwd)/data/:/var/lib/manticore -p 127.0.0.1:9306:9306 -d manticoresearch/manticore\n```\n\nTake into account that Manticore search inside the container is run under user `manticore`. Performing operations with table files (like creating or rotating plain tables) should be also done under `manticore`. Otherwise the files will be created under `root` and the search daemon won't have rights to open them. For example here is how you can rotate all tables:\n\n```bash\ndocker exec -it manticore gosu manticore indexer --all --rotate\n```\n\nYou can also set individual `searchd` and `common` configuration settings using Docker environment variables.  \n\nThe settings must be prefixed with their section name, example for in case of `mysql_version_string` the variable must be named `searchd_mysql_version_string`:\n\n\n```bash\ndocker run --name manticore  -p 127.0.0.1:9306:9306  -e searchd_mysql_version_string='5.5.0' -d manticoresearch/manticore\n```\n\nIf you intend to enable the own `listen` directive, utilize the `searchd_listen` environment variable.\n\nYou can specify multiple interfaces separated by a semicolon (`|`). To exclusively listen on a network address, employ the `$ip` variable (internally retrieved from `hostname -i`) as an address alias.\n\nFor example, using `-e searchd_listen='9312|9316:http|9307:mysql|$ip:5443:mysql_vip'` will configure the instance to listen for binary/replication on port `9312`, SQL on port `9307`, SQL VIP on port `5443` (restricted to the instance's IP, such as 172.17.0.2), and HTTP JSON on port `9316`.\n\n**Attention**: Setting this variable overrides the default listeners, so make sure to enable all the types of listeners you may need, including the binary listener for replication (it won't work without it).\n\n```bash\n$ docker run --rm -p 1188:9307  -e searchd_mysql_version_string='5.5.0' -e searchd_listen='9316:http|9307:mysql|$ip:5443:mysql_vip' manticoresearch/manticore\n[Mon Feb 19 10:12:20.501 2024] [1] using config file '/etc/manticoresearch/manticore.conf.sh' (297 chars)...\nstarting daemon version '6.2.13 56aaf1f55@24021713 dev (columnar 2.2.5 8c90c1f@240217) (secondary 2.2.5 8c90c1f@240217) (knn 2.2.5 8c90c1f@240217)' ...\nlistening on all interfaces for sphinx and http(s), port=9316\nlistening on all interfaces for mysql, port=9307\nlistening on 172.17.0.2:5443 for VIP mysql\nprereading 0 tables\npreread 0 tables in 0.000 sec\naccepting connections\n```\n\n### Startup flags\n\nTo start Manticore with custom startup flags, specify them as arguments when using docker run. Ensure you do not include the `searchd` command and include the `--nodetach` flag. Here's an example:\n```bash\ndocker run --name manticore --rm manticoresearch/manticore:latest --replay-flags=ignore-trx-errors --nodetach\n```\n\n### Running under non-root\nBy default, the main Manticore process `searchd` is running under user `manticore` inside the container, but the script which runs on starting the container is run under your default docker user which in most cases is `root`. If that's not what you want you can use `docker ... --user manticore` or `user: manticore` in docker compose yaml to make everything run under `manticore`. Read below about possible volume permissions issue you can get and how to solve it.\n\n\n### Building plain tables\n\nThere are several methods to build plain tables from your custom configuration file. There's the `CREATE_PLAIN_TABLES` (`docker run -e CREATE_PLAIN_TABLES=...`) evironment variable for that.\n\n1) **Build all plain tables on startup:**  \n   Simply set the environment variable to `CREATE_PLAIN_TABLES=1`.\n\n2) **Build specific tables on startup:**  \n   To initiate indexing for specific tables, use the following syntax: `CREATE_PLAIN_TABLES=tbl1;tbl2`.\n\n3) **Scheduled building of specific tables:**  \n   Schedule indexing tasks for specific tables using the format `CREATE_PLAIN_TABLES={table name}:{schedule in cron format}`.\n    * For a single table, use: `CREATE_PLAIN_TABLES=tbl:* * * * *`.\n    * To index multiple tables, format it like this: `CREATE_PLAIN_TABLES=tbl:* * * * *;tbl2:*/5 2 * * *`.\n\n4) **Combining scheduled and startup table rebuilding:**  \n   To combine scheduled building with the indexing of desired tables on startup, use this format: `CREATE_PLAIN_TABLES=tbl:* * * * *;tbl2:*/5 2 * * *;deltaTable;tbl3`.\n\n# Backup and restore\n\n### Full backup\n\n\nCreating a **full backup** is a straightforward process. Simply run the following command:\n\n```bash\ndocker exec -it CONTAINER-ID manticore-backup --backup-dir=/tmp\n```\nThis command will generate a backup in your `/tmp/` directory.\n\n```bash\n$ ls /tmp/ | grep backup-*\nbackup-20230509133521\n```\nInside this folder, you will find your backup.\n\n### Restore full dump\n\n\nTo restore your full backup on startup, you need to mount your backup to the `/docker-entrypoint-initdb.d` folder. \n\nPlease note that you should mount the content of your backup, not the backup folder itself (e.g., `backup-202307..`).\n\nThe backup will be restored if the data directory is empty. Otherwise, it will be skipped, even if it's mounted on the second launch or any other time. Once the backup is restored, the daemon will start.\n\n### Creating SQL dumps\n\n`manticore-backup` creates a physical backup. If you prefer a logical backup, you can use `mysqldump` in the container. For that use `docker exec` to log in to the container and run the tool. Here's an example:\n\n```bash\ndocker exec some-mysql sh -c 'exec mysqldump' \u003e /some/path/on/your/host/dump.sql\n```\n\n### Restore SQL dumps\n\nFor restoring data from an sql file created by `mysqldump`, you can use the `docker exec` command with the `-i` flag like this:\n\n```bash\ndocker exec -i MANTICORE_CONTAINER sh -c 'exec mysql' \u003c /some/path/on/your/host/dump.sql\n```\n\n# Building docker image with buildx\n\nTo build multi-arch images, we use the buildx docker plugin. Before building, follow these steps:\n\n```bash\ndocker buildx create  --name manticore_build --platform linux/amd64,linux/arm64\ndocker buildx use manticore_build\ndocker run --rm --privileged multiarch/qemu-user-static --reset -p yes\n```\n\nOnce the above steps are completed, run the following `build` and `push` commands:\n\n```bash\ndocker buildx build --push --build-arg DEV=1 --platform linux/arm64,linux/amd64 --tag  manticoresearch/manticore:$BUILD_TAG .\n```\n\n# Troubleshooting\n\n### Permissions issue with a mounted volume\n\nIn case you are running Manticore Search docker under non-root (using `docker ... --user manticore` or `user: manticore` in docker compose yaml), you can face a permissions issue, for example:\n```bash\nFATAL: directory /var/lib/manticore write error: failed to open /var/lib/manticore/tmp: Permission denied\n```\nThis can happen because the user which is used to run processes inside the container may have no permissions to modify the directory you have mounted to the container. To fix it you can `chown` or `chmod` the mounted directory. If you run the container under user `manticore` you need to do:\n```bash\nchown -R 999:999 data\n```\n\nsince user `manticore` has ID 999 inside the container.\n\n# Issues\n\nFor reporting issues, please use the [issue tracker](https://github.com/manticoresoftware/docker/issues).\n\n## License Notice\n\nThis Docker image includes multiple independent components, each with its own license:\n\n1. [Manticore Search](https://github.com/manticoresoftware/manticoresearch), [Manticore Buddy](https://github.com/manticoresoftware/manticoresearch-buddy), [Manticore Backup](http://github.com/manticoresoftware/manticoresearch-backup): [GPLv3](https://www.gnu.org/licenses/gpl-3.0.html)\n2. [Manticore Columnar Library](http://github.com/manticoresoftware/columnar): [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)\n3. [Manticore Executor](http://github.com/manticoresoftware/executor): [PHP License 3.01](https://www.php.net/license/3_01.txt)\n4. Docker image packaging scripts (Dockerfile, entrypoint scripts, and related files) (MIT License)\n\nEach component group operates as a standalone module, and its respective license applies.\n\nMore info in the [component licenses](./component-licenses/NOTICE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanticoresoftware%2Fdocker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanticoresoftware%2Fdocker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanticoresoftware%2Fdocker/lists"}