简体   繁体   English

使用 docker 为图像撰写时没有为 aws 提供凭据

[英]No Credentials Provided for aws while using docker compose for a image

I am getting the below error of No Credentials Provided.我收到以下未提供凭据的错误。 I can see in the mount I have mounted the correct folder (Image attched).我可以在挂载中看到我挂载了正确的文件夹(附上图片)。 If I use a different image (amazon/aws-otel-collector:latest) the credentials work fine.如果我使用不同的图像 (amazon/aws-otel-collector:latest),凭据可以正常工作。 But I want to use (otel/opentelemetry-collector-contrib:latest) image.但我想使用 (otel/opentelemetry-collector-contrib:latest) 图像。

Failed to create stream token {"kind": "exporter", "data_type": "logs", "name": "awscloudwatchlogs", "error": "NoCredentialProviders: no valid providers in chain. Deprecated.\n\tFor verbose messaging see aws.Config.CredentialsChainVerboseErrors"}无法创建 stream 令牌 {"kind": "exporter", "data_type": "logs", "name": "awscloudwatchlogs", "error": "NoCredentialProviders: no valid providers in chain. Deprecated.\n\tFor verbose消息传递请参阅 aws.Config.CredentialsChainVerboseErrors"}

docker-compose.yml docker-compose.yml

version: "3.7"
services:
  otel:
    image:  otel/opentelemetry-collector-contrib:latest
    command: --config /config/collector-config-local.yml
    volumes:
      - $Userprofile/.aws:/root/.aws
      - .:/config
    environment:
      - AWS_REGION=ap-southeast-2
    ports:
      - '4317:4317'

collector-config-local.yml收集器-config-local.yml

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317

exporters:
  logging:
    loglevel: info
  awscloudwatchlogs:
    log_group_name: "odessey/telemetry/test"
    log_stream_name: "teststream"
    region: ap-southeast-2
    endpoint: "logs.ap-southeast-2.amazonaws.com"                     
    sending_queue:
     queue_size: 10
    retry_on_failure:
     enabled: true
     initial_interval: 10ms
    
service:
  pipelines:
    logs:    
      receivers:
       - otlp
      exporters: 
       - awscloudwatchlogs
   

在此处输入图像描述

Alright Had to add environment variable in the docker compose file.好吧 必须在 docker 撰写文件中添加环境变量。 Below is the working approach.以下是工作方法。

version: "3.7"
services:
  otel:
    image:  otel/opentelemetry-collector-contrib:latest
    command: --config /config/collector-config-local.yml
    volumes:
      - $Userprofile/.aws:/root/.aws
      - .:/config
    environment:
      - AWS_REGION=ap-southeast-2
      - AWS_ACCESS_KEY_ID=MyKEY
      - AWS_SECRET_ACCESS_MySecret
    ports:
      - '4317:4317'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM