How to use `--format` flag?

QuestionsQuestions8 SkillsProDec, 24 2025
095

Great question! The --format flag is very powerful because it allows you to extract specific pieces of information from that long JSON output instead of reading the whole thing.

It uses Go templates, where you wrap the keys you want to see in curly braces {{ }}.

Here are a few common examples you can try on your jenkins container:

1. Extract the IP Address

If you only want to see the IP address assigned to the container:

docker container inspect --format '{{ .NetworkSettings.IPAddress }}' jenkins

2. Check the Container Status

To quickly check if it is "running" or "exited":

docker container inspect --format '{{ .State.Status }}' jenkins

3. See the Log Path

To find out exactly where the container logs are stored on your host machine:

docker container inspect --format '{{ .LogPath }}' jenkins

4. Multiple values

You can even combine them and add your own text:

docker container inspect --format 'Name: {{ .Name }} | Status: {{ .State.Status }}' jenkins

Pro Tip: Look at the original JSON structure. The dots in the format string (e.g., .State.Status) represent the hierarchy of the keys in that JSON.

Give one of these a try in your terminal! It makes managing Docker much faster. Support is always here if you need more help!

0 Comments

no data
Be the first to share your comment!