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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shaun VermaakTechnical SpecialistCommented:
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
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
Check Out How Miercom Evaluates Wi-Fi Security!

It's not just about Wi-Fi connectivity anymore. A wireless security breach can cost your business large amounts of time, trouble, and expense. Plus, hear first-hand from Miercom on how WatchGuard's Wi-Fi security stacks up against the competition plus a LIVE demo!

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:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Prabhin MPEngineer-TechOPSCommented:
0
Bharath A.KAuthor Commented:
Hi Experts

Thank you all

Regards,
Bharath AK
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
AWS

From novice to tech pro — start learning today.