title: Set awslogs log driver on docker container
body: <p>I want to pass my container logs to AWS Cloud Watch.</p>
  
  <p>I'm not able to set the AWS credentials in the Docker Desktop for Mac.</p>
  
  <pre><code>Docker Version : Version 19.3.5 
  Mac OS Version : 10.14.6
  </code></pre>
  
  <p>I have created <code>~/.aws/credentials</code> files with the AWS credentials.</p>
  
  <pre><code>aws_access_key_id : XXXXXXX,
  aws_secret_access_key" : XXXXXXXX
  </code></pre>
  
  <p>I tried to run the Docker with the following ways:</p>
  
  <pre><code>docker run --name flask -v ${HOME}/.aws/:/root/.aws/:ro -d --log-driver=awslogs --log-opt awslogs-region=XXXX --log-opt awslogs-group=XXXX --log-opt awslogs-create-group=true flask-image
  </code></pre>
  
  <p>The IAM user that configured policy is:</p>
  
  <pre><code>{
      "Version": "2012-10-17",
      "Statement": [
          {
              "Action": [
                  "logs:CreateLogStream",
                  "logs:PutLogEvents"
              ],
              "Effect": "Allow",
              "Resource": "*"
          }
      ]
  }
  </code></pre>
  
  <p>But got the following error: </p>
  
  <pre><code>docker: Error response from daemon: failed to initialize logging driver: failed to create Cloudwatch log stream: NoCredentialProviders: no valid providers in chain. Deprecated.
      For verbose messaging see aws.Config.CredentialsChainVerboseErrors.
  </code></pre>
  
  <p>I have also added to the <code>docker.json</code> file.</p>
  
  <p>And in the Docker Daemon file put the AWS logging options.</p>
  
  <pre><code>{
  "log-driver" : "awslogs",
  "log-opts" : {
  "awslogs-region" : "xxxx",
  "awslogs-group" : "xxxxx",
  "awslogs-stream" : "xxxxx"
  }
  }
  </code></pre>
  
  <p>From investigation I found that I need to set the AWS credentials inside the Docker daemon and not enough on my Docker host. As you see I tried to do this with the volume but no success.</p>
  
  <p>I'm running the Docker on my Mac, does anyone have an idea how to solve this issue?</p>