Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I access Windows eventlog of a Docker container

Tags:

How do I access the Windows Event Log of a Microsoft Docker container from the host?

I have a docker container under Windows Server 2016.

The container is based on image: microsoft/iis

I can get the ip address of the container with:

docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" my-running-site 

How can I connect to it via the Event Viewer on the windows host?

like image 553
Greg Pagendam-Turner Avatar asked Dec 19 '16 03:12

Greg Pagendam-Turner


People also ask

How do I pull a docker window image?

Run a Windows container using Windows Admin Center First, open the container host you want to manage, and in the Tools pane, select the Containers extension. Then, select the Images tab inside the Container extension under Container Host. In the Pull Container Image settings, provide the image URL and the tag.

How can I see live logs of a container?

You can run the container in foreground mode so you will able to see log. -it keep the container running in foreground as a result you will able to see your container logs. You will able to see live logs same like running application in terminal.

Can I access the logs of the docker container?

The docker logs command shows information logged by a running container. The docker service logs command shows information logged by all containers participating in a service. The information that is logged and the format of the log depends almost entirely on the container's endpoint command.


1 Answers

Create a powershell session for the container

docker exec -it  <container_id> powershell 

Then from the container, get the latest event logs

Get-Eventlog -newest 20 application 

Above command will help you to find the index,

(Get-Eventlog -index xxx application).message 
like image 92
Praveen Kumar Avatar answered Sep 22 '22 19:09

Praveen Kumar