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

761
Visualizações
Docker composer, constraint - did not find expected key

We using docker CE(latest) and docker composer version 3.I have a .yml for for 3 services but I want to constraint grafana to the master of the swarm. When adding the constraint I get

yaml: line 32: did not find expected key Tthe script is this:

version: '3'
services:
  influxdb:
    image: "influxdb:latest"
    volumes:
      - /mount/set/influxdb:/var/lib/influxdb
    ports:
      - "5076:5076"
    networks:
      - production

  kapacitor:
    image: "kapacitor:latest"
    environment:
      KAPACITOR_HOSTNAME: kapacitor
      KAPACITOR_INFLUXDB_0_URLS_0: http://influxdb:5086
    volumes:
      - /mount/set/kapacitor:/var/lib/kapacitor
    ports:
      - "9092:9092"
    networks:
      - production

  grafana:
    image: "grafana/grafana:latest"
      ports:
        - "7000:7000"
      networks:
        - production
      deploy:
        placement:
          constraints: [node.role == manager]
      volumes:
        - /iSCSIDisk/grafana/grafana.ini:/etc/grafana/grafana.ini
        - /iSCSIDisk/grafana/lib:/var/lib/grafana
      environment:
        GF_SECURITY_ADMIN_PASSWORD: secretsecret

      networks:
        production:
          external: true

I combed over the script several times and could not find any reason for the error, I may be overlooking something, I checked for non-spaces etc, and could not find anything, I checked other articles regarding the same error, and I don't seem to have any missing brackets or duplicates too. Your help will be much appreciated, thank you. :)

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Your indentation is broken in the grafana section. Everything after image is spaced in two extra spaces.

over 4 years ago · Santiago Trujillo Relatório

0

It is common error with docker-compose.yml file depend on extra spaces. If you use vi or vim you can remove all extra spaces with :%s/\s\+$//e command.

over 4 years ago · Santiago Trujillo Relatório

0

This can happen if you are using dictionary type declarations for your environment variables.

In my case I had to change the format

environment:      
  DATASTORE_EMULATOR_HOST: "${DATASTORE_ENDPOINT}:${DATASTORE_PORT}"

to

environment:
  - DATASTORE_EMULATOR_HOST=${DATASTORE_ENDPOINT}:${DATASTORE_PORT}

The only thing that changed for me was upgrading my docker desktop installation

over 4 years ago · Santiago Trujillo Relatório
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