I'm reworking a bunch of scripts using the deprecated docker run --link option in favor of user-defined bridges.

By searching in the doc, I didn't find any command to list all containers attached to a given network. For now, I am parsing the JSON output of docker network inspect through the jq tool; I've posted that as an answer below since it may help someone. But, do you know another option to achieve that? Maybe using a dedicated Docker command, option or a custom Go format?

1 Answer 1


The docker network inspect command produces a JSON output that can be parsed using jq to extract the relevant piece of information:

sudo docker network inspect app-bridge | jq '.[].Containers[].Name'


If you are already familiar with JSON processing with jq, the advantage is you can reinvest your knowledge without having to bother with Go templates. On the other hand, it relies on an external tool which may or may be not available at your site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.