Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
Restart a docker container when it is higher than from a certain of memory limitation?

I want to have a policy in my docker-compose which a docker container memory usage will be higher than the amount of a certain memory limitation it restarts.

This is what I have done so far:

version: '3'

services:
    modbus_collector:
        build: .
        image: modbus_collector:2.0.0
        container_name: modbus_collector
        restart: unless-stopped
        deploy:
          resources:
            limits:
              memory: 28M

I was expecting that to be restarted when the container memory usage exceeds 28M, but when I monitor docker containers by docker stats I see that this container memory usage grow up and not happens about restart!

I also tried by restart: always but the result was the same.


[UPDATE]:

With version 2 it works fine with mem_limit:. But it fails while using version 3, putting them under deploy section doesn't seem worthy unless I am using swarm mode.

Even on version 2.1, I have a problem in restarting the container: limitation applied correctly, but when the container memory usage grows up, this limitation prevents of that but I expected instead of decrease memory it will restart that container.

version: '2.1'

services:
    modbus_collector:
        build: .
        image: modbus_collector:2.0.0
        container_name: modbus_collector
        restart: unless-stopped
        mem_limit: 28m
over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda