32

I am running my docker container in AWS ECS. When i try to execute the below command to read the logs from container, i am facing the below error.

command: docker logs -f "Container ID"

Error response from daemon: configured logging driver does not support reading.

Any feasible solutions are welcome.

palani.p
  • 521
  • 1
  • 7
  • 13
  • can you share the output of "docker info" and "docker inspect ? – Girdhar Sojitra Sep 14 '18 at 07:31
  • Is your container/daemon/agent [configured to use the awslogs log driver](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_awslogs.html)? – David Maze Sep 14 '18 at 12:12
  • Did u specify your docker log driver? I think that’s the issue. You may share your Docker configuration above in your question. – Light.G Sep 16 '18 at 05:44
  • Hello, This container is managed by AWS Batch. Where i can see the logs in AWS Cloudwatch. But If I log into container instance and execute "docker logs -f "Container ID"" , then I am facing above mentioned error. – palani.p Sep 18 '18 at 13:17

4 Answers4

10

According to information commented by David Maze, you must have your container run with a awslogs log driver.

Here is the setting introduction.

After changing log driver to json-file, you could get log by executing docker logs container-id/name.

But still note this:

If using the Fargate launch type, the only supported value is awslogs.

Light.G
  • 5,548
  • 1
  • 14
  • 25
6

You are using awslogs log-driver, and docker logs command is not available for that driver.

From the docs:

The docker logs command is not available for drivers other than json-file and journald

limitations of logging drivers

Akavall
  • 82,592
  • 51
  • 207
  • 251
2

I got this issue because docker is out of storage. I fixed it by removing old docker images with docker rmi <immage_id_1> <immage_id_2>

1

I have had this same issue before.

In my specific case the Task Definition for that service in ECS had the Log Configuration's logDriver set to fluentd see the circled image below.

enter image description here

To resolve the issue, I created another Task Definition with all the same parameters except I left the Log Configuration section's Log Driver to default. note if you click on that you'll see other log drivers including fluentd.

After that I pointed the service to this task definition in my ECS cluster, and now I can see the logs doing the commands docker logs <container id>

enter image description here

CAMD_3441
  • 2,514
  • 2
  • 23
  • 38