Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I provide credentials to the docker awslogs driver using Docker for Mac?

Tags:

I'm trying to use the docker awslogs driver and getting the following error:

"docker: Error response from daemon: Failed to initialize logging driver: NoCredentialProviders: no valid providers in chain. Deprecated."

According to this GitHub comment, I need to set the AWS_SHARED_CREDENTIALS_FILE environment variable for the docker daemon, but I'm not sure how to do that when using Docker for Mac.

The command I'm using to start the container is:

docker run -d \  --log-driver=awslogs \  --log-opt awslogs-region=us-east-1 \  --log-opt awslogs-group=my-log-group \  my-image 

Version information:

  • Docker for Mac 1.12.1-rc1-beta23 build 11375
  • OS X El Capitan 10.11.6
like image 218
Mike Ottum Avatar asked Aug 19 '16 20:08

Mike Ottum


People also ask

What is Awslogs?

awslogs is a simple command line tool for querying groups, streams and events from Amazon CloudWatch logs.

How awslogs works?

The awslogs logging driver sends your Docker logs to a specific region. Use the awslogs-region log option or the AWS_REGION environment variable to set the region. By default, if your Docker daemon is running on an EC2 instance and no region is set, the driver uses the instance's region.


1 Answers

but I'm not sure how to do that when using Docker for Mac.

With boot2docker, you would need to modify /var/lib/boot2docker/profile in order to add this variable.
See "Docker daemon config file on boot2docker".
It does persists across the TinyCore-based VM reboot, and the docker daemon would then take it into account.

With the new docker for Mac xhyve-based, the idea should be the same.
/var/lib/boot2docker/profile does exist as well, as shown in this answer.
The official docker dameon doc points to:

--config-file=/etc/docker/daemon.json  Daemon configuration file 

So try and modify this file.

By default, the comments mention:

~/Library/Containers/com.docker.docker/Data/database/com.doc‌​ker.driver.amd64-lin‌​ux/etc/docker/daemon‌​.json 
like image 61
VonC Avatar answered Sep 18 '22 12:09

VonC