How To Get Information About a Container In Docker – The Geek Diary (2024)

by admin

Here is a short note on how to pull information of the container running on the host. This is similar to the “xm list –long [domain_ID]” command in xen.

Getting information from outside of the Docker Container

1. Below are the list of images that are residing on the host node.

# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEfedora latest 422dc563ca32 2 days ago 252MBubuntu latest dd6f76d9cc90 13 days ago 122MBhello-world latest 725dcfab7d63 13 days ago 1.84kBcentos latest d123f4e55e12 13 days ago 197MB

2. Start one of the docker images.

# docker run -it -d 422dc563ca32 /bin/bash52249ba75f0fa33f93202f4a2d7f83bc71600b8b75ea4db0bc5b56022bf254b6

3. Verify the new Docker container is running.

# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES52249ba75f0f 422dc563ca32 "/bin/bash" About a minute ago Up About a minute gracious_keller

The “inspect“” command will list the complete information of the container. Use the container ID listed in the first column with the inspect option. You will get a pretty long output here.

# docker inspect 52249ba75f0f[ { "Id": "52249ba75f0fa33f93202f4a2d7f83bc71600b8b75ea4db0bc5b56022bf254b6", "Created": "2017-11-17T14:38:05.340313315Z", "Path": "/bin/bash", "Args": [], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 1535, "ExitCode": 0, "Error": "", "StartedAt": "2017-11-17T14:38:05.638951265Z", "FinishedAt": "0001-01-01T00:00:00Z" } .......

4. This can also be truncated based on what needs to be verified. For example, you could only get information on the networking part of the Docker Container.

# docker inspect --format='{{ .NetworkSettings.IPAddress }}' 52249ba75f0f172.17.0.2
# docker inspect --format='{{ .NetworkSettings.Gateway }}' 52249ba75f0f172.17.0.1

Getting Information from inside the Docker Container

The below example is to show the settings from inside the Docker container.

1. First, attach to the docker container.

# docker attach 52249ba75f0f

2. When you attach to a brand new container, commands like ifconfig, route will not work. As the docker is a bare minimal installation and we have to install the packages as and when they are required. So, to run ifconfig and route command, first install the net-tools package.

# yum install net-tools

3. Now run the commands ifconfig and route to get the required information about the Docker container.

# ifconfig -aeth0: flags=4163[UP,BROADCAST,RUNNING,MULTICAST] mtu 1500 inet 172.17.0.2 netmask 255.255.0.0 broadcast 0.0.0.0 ether 02:42:ac:11:00:02 txqueuelen 0 (Ethernet) RX packets 36502 bytes 72894961 (69.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 22286 bytes 1594850 (1.5 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73[UP,LOOPBACK,RUNNING] mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 loop txqueuelen 1 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
# route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 172.17.0.1 0.0.0.0 UG 0 0 0 eth0172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0

Container config file

Also, the information about the container will be stored as config file and can be used to re-initiate the container. The path location for the container can be collected from the earlier “inspect” command.

You May Also Like

How To Get Information About a Container In Docker – The Geek Diary (2024)
Top Articles
Labour Day in Germany in 2023 | Office Holidays
Microsoft Business Intelligence Solutions | ABCloudz
Devin Mansen Obituary
Ups Customer Center Locations
Northern Counties Soccer Association Nj
Brady Hughes Justified
Terrorist Usually Avoid Tourist Locations
Cumberland Maryland Craigslist
Joe Gorga Zodiac Sign
Bubbles Hair Salon Woodbridge Va
Red Heeler Dog Breed Info, Pictures, Facts, Puppy Price & FAQs
Tripadvisor Near Me
Connexus Outage Map
Things To Do In Atlanta Tomorrow Night
Notisabelrenu
Insidekp.kp.org Hrconnect
Ts Lillydoll
Scenes from Paradise: Where to Visit Filming Locations Around the World - Paradise
Does Breckie Hill Have An Only Fans – Repeat Replay
50 Shades Of Grey Movie 123Movies
Jbf Wichita Falls
Aaa Saugus Ma Appointment
Satisfactory: How to Make Efficient Factories (Tips, Tricks, & Strategies)
The Old Way Showtimes Near Regency Theatres Granada Hills
How many days until 12 December - Calendarr
Cain Toyota Vehicles
Costco Jobs San Diego
Publix Christmas Dinner 2022
Taylored Services Hardeeville Sc
*!Good Night (2024) 𝙵ull𝙼ovie Downl𝚘ad Fr𝚎e 1080𝚙, 720𝚙, 480𝚙 H𝙳 HI𝙽DI Dub𝚋ed Fil𝙼yz𝚒lla Isaidub
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Lowell Car Accident Lawyer Kiley Law Group
Cars And Trucks Facebook
Craigslist Ludington Michigan
Envy Nails Snoqualmie
Goodwill Thrift Store & Donation Center Marietta Photos
Tmka-19829
Best Restaurants West Bend
Nina Flowers
Pekin Soccer Tournament
Fool's Paradise Showtimes Near Roxy Stadium 14
Grand Valley State University Library Hours
'The Nun II' Ending Explained: Does the Immortal Valak Die This Time?
BCLJ July 19 2019 HTML Shawn Day Andrea Day Butler Pa Divorce
Shiftselect Carolinas
91 East Freeway Accident Today 2022
Zalog Forum
Costco Gas Price Fort Lauderdale
How Did Natalie Earnheart Lose Weight
Who We Are at Curt Landry Ministries
Dr Seuss Star Bellied Sneetches Pdf
Latest Posts
Article information

Author: Annamae Dooley

Last Updated:

Views: 5429

Rating: 4.4 / 5 (65 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Annamae Dooley

Birthday: 2001-07-26

Address: 9687 Tambra Meadow, Bradleyhaven, TN 53219

Phone: +9316045904039

Job: Future Coordinator

Hobby: Archery, Couponing, Poi, Kite flying, Knitting, Rappelling, Baseball

Introduction: My name is Annamae Dooley, I am a witty, quaint, lovely, clever, rich, sparkling, powerful person who loves writing and wants to share my knowledge and understanding with you.