Mike Ottum
Mike Ottum

Reputation: 1409

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

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:

Upvotes: 23

Views: 3975

Answers (2)

aemus
aemus

Reputation: 723

Using information taken from this answer: Docker deamon config path under mac os

You can connect to the VM layer that runs the docker daemon using:

screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty

And you can modify /etc/docker/daemon.json to add the needed variables there.

Once you make your changes, you can just run:

service docker restart

from within the moby terminal to restart the docker daemon.

Do notice that if you restart docker from your mac, the changes will not persist.

On a side note, if you encounter a login screen when connecting with the screen command, try username: root to access the system.

Upvotes: 0

VonC
VonC

Reputation: 1324937

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

Upvotes: 1

Related Questions