Map Docker compose volume with cloudwatch logs

Viewed 114

Docker compose services uses the volume with /test/app. The logs will be stored on /test/app. Then I used to view the logs through AWS cloudwatch console. But i am facing the below error while starting the services using docker-compose.

version: '3.9'
services:

  test-media:
    image: test-media:test
    container_name: test
    restart: "no"
    volumes:
      - /test/app:/app/test-media/logs
    ports:
      - 3000:3000
    networks:
      - test-network

networks:
  test-network:

"Cannot start service test-media: error while creating mount source path '/test/app': mkdir /test: read-only file system"

suggest me on how to map the docker volume path /test/app to cloudwatch logs group.

Followed the below steps for cloudwatch configurations.

To install and configure CloudWatch Logs on an existing Ubuntu Server

curl https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py -O

sudo python ./awslogs-agent-setup.py --region ap-south-1

Step 1 of 5: Installing pip ...libyaml-dev does not exist in system python-dev does not exist in system DONE

Step 1 of 5: Installing pip ...libyaml-dev does not exist in system python-dev does not exist in system DONE

Step 2 of 5: Downloading the latest CloudWatch Logs agent bits ... DONE

Step 3 of 5: Configuring AWS CLI ... 

AWS Access Key ID [****************UY56]: 

AWS Secret Access Key [****************67BR]:
 
Default region name [ap-south-1]: 

Default output format [json]: 

Step 4 of 5: Configuring the CloudWatch Logs Agent ... 

Path of log file to upload [/var/log/syslog]: /test/app/test-media.log  

Destination Log Group name [/test/app/test-media.log]: /test/app/test-media.log
0 Answers
Related