'How to write a command to be executed in the docker compose?
I am kind of new to docker and docker compose. I am using 20.10.12 version of docker and 2.9.0 of portainer. My aim is to do the docker compose for elasticSearch to deploy it in portainer but I get a problem that the memory given is not enough. After looking through other questions I found that I could execute the following bash command to assign a bigger limit to the VM memory
sysctl -w vm.max_map_count=262144
So my .yml is like this:
version: "3.8"
services:
command: >
bash -c ' sysctl -w vm.max_map_count=262144'
master1:
image: docker.elastic.co/elasticsearch/elasticsearch:8.0.0
environment:
node.name: "master1"
ulimits:
memlock:
soft: -1
hard: -1
deploy:
endpoint_mode: dnsrr
mode: "replicated"
replicas: 1
resources:
limits:
memory: 4G
The problem is that when I try to deploy this compose, it says "services.command must be a mapping".
I think that problem is raised when then indentation is not correct but I think in my case is indented correctly.
Solution 1:[1]
vm.max_map_count must be set on the host, and not in the docker container.
Set it as described in this official doc.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Amit |
