to enable logs for docker containers

Hi Experts,

         I am using docker containers, in my development environment.  It is Ubuntu on AWS.  I had built docker images and run docker containers.

when I try "docker ps"  it displays all running docker containers.  But not able to see the logs and application is not harvesting data(elastic search) from the application.  I can see only few results there are nearly, 8 to 10 docker containers and I am able to see all the images running.  I am not able the see the logs for all the containers.  secondly, there are less results from the harvesters application.  

How will I enable the logs for the containers?   Please help me.

Kind Regards,

Bharath AK
LVL 1
Bharath A.KAsked:
Who is Participating?
 
Prabhin MPEngineer-TechOPSCommented:
Hi Bharath,

Cloudwatch is a managed service in AWS which will monitor the other services like EC2,RDS etc based on some metrics like CPU utilization, read and write etc.,
the logs in cloudwatch related are related to things which i mentioned above.
application logs means, consider a web application which have a webserver apache . for all the web request logs will be generated and stored the directory where its configured.

Hope you got a simple understanding about this.
0
 
Shaun VermaakTechnical Specialist/DeveloperCommented:
Did you run?
docker logs --details CONTAINER

Open in new window

0
 
Prabhin MPEngineer-TechOPSCommented:
Hi ,
First you enable  debugging option in docker

create / edit a file /etc/docker/daemon.json
and add the following lines

{
    "debug": true
}

restart the docker service.



after that use docker logs <containerID>
to see more logs
0
WEBINAR: 10 Easy Ways to Lose a Password

Join us on June 27th at 8 am PDT to learn about the methods that hackers use to lift real, working credentials from even the most security-savvy employees. We'll cover the importance of multi-factor authentication and how these solutions can better protect your business!

 
Bharath A.KAuthor Commented:
Hi Experts,

        I am able the see the logs for few containers, but not for all the running containers.  What would be the reason?

Secondly ,  how to create an container and run on an aws ubuntu machine.  I have a dockerfile,, from which I can make a docker image.  From Image how can I create a container and run on this aws ubuntu machine.  Please throw some light over it.

With Many thanks,
Bharath AK
0
 
Prabhin MPEngineer-TechOPSCommented:
Hi Bharath,
are  your images are custom images?

if you want to see the logs inside the container
user docker exec -it <containerID>  /bin/bash/
0
 
Prabhin MPEngineer-TechOPSCommented:
Bharath,
For setting up docker image in aws machine you should install docker engine first in ubuntu server, later you can follow  this link for setting the image from docker file.

https://deis.com/blog/2015/creating-sharing-first-docker-image/
0
 
Bharath A.KAuthor Commented:
Hi Prabin,

      I had tried this command it changed the command prompt to container, when I try
 docker exec -it 43583542fc10 /bin/bash  it changed from root@ip-10-252-14-11:/home/ubuntu/workarea/sourcecode/harvest-lms#

to root@43583542fc10:/home/lms#  .   it is like a folder with few files.   When I run docker logs <containername>  i can see the logs for few containers for example docker logs ntdl It display the docker logs on that console or putty terminal.  

where as going inside the with docker exec -it <containerId>  bin/bash it goes to another command prompt.  how can I see the logs?

With Many thanks,
Bharath AK
0
 
Prabhin MPEngineer-TechOPSCommented:
Hi Bharath,
 root@43583542fc10:/home/lms means you are logged into the container. you can see the logs of the apps if you go to the log location.
0
 
Bharath A.KAuthor Commented:
Hi Prabhin,

        Thank you so much.  I am able go inside container and ls all folders and see all inside that containers.  I found there are no logs folder or file inside that folder, might be logs might not be generated by that application.  I need one more clarification., What is cloud watch, there are logs inside the cloudwatch in AWS, whatz the difference between the logs generated by application vs logs in the cloud watch.  Please throw some light over it.

With Many Thanks,

Bharath AK
0
 
Prabhin MPEngineer-TechOPSCommented:
0
 
Bharath A.KAuthor Commented:
Hi Experts

Thank you all

Regards,
Bharath AK
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.