Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Erro ao criar o container

Utilizando o código informado não consigo criar o container.

version: '3.8'

networks:
  database:
  monit:
  
services:

  database:
    image: postgres
    container_name: database-api-cursos
    restart: unless-stopped
    healthcheck:
      test: [ "CMD", "pg_isready", "-q", "-d", "postgres", "-U", "root" ]
      timeout: 45s
      interval: 10s
      retries: 10
    environment:
      - POSTGRES_USER=root
      - POSTGRES_PASSWORD=h5UzM2kEnp8Q42
      - APP_DB_USER=alura
      - APP_DB_PASS=nJ6vsW37rCd1v88
      - APP_DB_NAME=logsdb
    ports:
      - '5432:5432'
    volumes:
      - ./postgres/db:/docker-entrypoint-initdb.d/
      - ./postgres/data:/var/lib/postgresql/data
    networks:
      - database
grafana-api-cursos:
    user: "SUID:SGID"
    image: grafana/grafana
    container_name: grafana-api-cursos
    volumes:
      - ./grafana:/var/lib/grafana
    restart: unless-stopped
    ports:
      - 3000:3000
    networks:
      - monit

Mensagem do erro.

database-api-cursos is up-to-date
Starting grafana-api-cursos ... error

ERROR: for grafana-api-cursos  Cannot start service grafana-api-cursos: unable to find user SUID: no matching entries in passwd file

ERROR: for grafana-api-cursos  Cannot start service grafana-api-cursos: unable to find user SUID: no matching entries in passwd file
ERROR: Encountered errors while bringing up the project.
1 resposta
solução!

Para funcionar devemos utilizar a mesma configuração do yaml da ultima aula (Confiabilidade garantindo estado integridade) e não utilizar o user: "SUID:SGID".

version: '3.8'

networks:
    database:
    monit:
  
services:

  database:
    image: postgres
    container_name: database-api-cursos
    restart: unless-stopped
    healthcheck:
      test: [ "CMD", "pg_isready", "-q", "-d", "postgres", "-U", "root" ]
      timeout: 45s
      interval: 10s
      retries: 10
    environment:
      - PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/15/bin
      - HOSTNAME=9226aec39768     
      - APP_DB_USER=alura
      - APP_DB_PASS=nJ6vsW37rCd1v88
      - APP_DB_NAME=logsdb     
      - POSTGRES_USER=root
      - POSTGRES_PASSWORD=h5UzM2kEnp8Q42      
      - GOSU_VERSION=1.14
      - LANG=en_US.utf8
      - PG_MAJOR=15
      - PG_VERSION=15.1-1.pgdg110+1
      - PGDATA=/var/lib/postgresql/data HOME=/root
    ports:
      - '5432:5432'
    volumes:
      - ./postgres/db:/docker-entrypoint-initdb.d/
      - ./postgres/data:/var/lib/postgresql/data
    networks:
      - database
      
  grafana-api-cursos:
    #user: "SUID:SGID"
    image: grafana/grafana
    container_name: grafana-api-cursos
    volumes:
      - ./grafana:/var/lib/grafana
    restart: unless-stopped
    ports:
      - 3000:3000
    networks:
      - monit