Docker Community Forums

Share and learn in the Docker community.

Docker container generating logs locally even after providing fluentd logging driver

Hi I have 2 Google cloud VM ( ubuntu) where I have following configuration for docker :
Machine 1 has : Docker version 18.03.1-ce, build 9ee9f40
Machine 2 has : Docker version 20.10.0, build 7287ab3

  1. I tried with docker compose file on both machines
    SERVIC_NAME:
    image: IMAGE_NAME
    container_name: CONTAINER_NAME
    expose:
    • “1311”
      ports:
    • “1311:1311”
      logging:
      driver: fluentd
      options:
      fluentd-address: my.fluentd.com:15753

sudo docker-compose -f docker-compose.yaml run --name=CONTAINER_NAME -d IMAGE_NAME

Result:
Machine 1:
sudo docker logs container_name -f
Error response from daemon: configured logging driver does not support reading
(All logs are forwarded to fluentd )

Machine 2:
sudo docker logs container_name -f
I could see logs getting generated ( which is not expected as i have provided logging driver)
Also All logs are forwarded to fluentd

  1. I tried with simple docker run command.
    sudo docker run --log-driver=fluentd --log-opt fluentd-address:15753=my.fluentd.com --name CONTAINER_NAME IMAGE_NAME
    Result:
    Machine 1:
    sudo docker logs container_name -f
    Error response from daemon: configured logging driver does not support reading
    (All logs are forwarded to fluentd )

Machine 2:
sudo docker logs container_name -f
I could see logs getting generated ( which is not expected as i have provided logging driver)
Also All logs are forwarded to fluentd

I am expecting similar thing like Machine 1 that docker container should not generate any logs locally when I use logging driver with fluentd.

Am I missing here? Is it because of the newer version of the docker ?
Machine 1 has : Docker version 18.03.1-ce, build 9ee9f40
Machine 2 has : Docker version 20.10.0, build 7287ab3
( Could not understand why -ce is not there in latest version )
Please help me out here.