Tdd Apps

# Send your Docker container logs to AWS using the log-driver

Jun 26, 2016 1 minute read

Docker supports several logging drivers to forward container logs. These are the steps to configure the AWS CloudWatch log driver to ship the hello-world container logs.

The instructions of this guide are based on Docker 1.9.

Step 1: Configure AWS Cloudwatch

We need an Access Key Id and a Secret Access Key that can forward logs to Cloudwatch. Here’s how to configure AWS Cloudwatch for Log Forwarders.

Step 2: Configure your docker daemon to use the AWS credentials

Mac OS X

These instructions are for the Docker Toolbox because Docker for Mac is still in beta.

1- Open a Docker QuickStart Terminal
2- Stop the the default docker-machine

docker-machine stop default

3- Create a new awslogs docker-machine with the AWS credentials

docker-machine create -d virtualbox \
    --engine-env AWS_REGION=us-east-1 \
    --engine-env AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxx \
    --engine-env AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxx \


The following GitHub Issue details the steps to configure AWS credentials on Ubuntu.

Docker Cloud

No support for log drivers yet.

Step 3: Run the Container

docker run \
    --log-driver=awslogs \
    --log-opt awslogs-region=us-east-1 \
    --log-opt awslogs-group=sample-docker-logs \
    --log-opt awslogs-stream=hello-world-logs \

Step 4: Review the logs

1- Open the CloudWatch sample-docker-logs group
2- Open the hello-world-logs stream

Your should be able to see your logs
Hello-World container logs

Never miss a post. Subscribe to our newsletter