May 04 2015

docker inspect inside an Ansible task with a Go template

This has bugged me on and off for a little while and I've finally found a way that works. Here's an example:

- command: >
    docker inspect -f \{\{' 'index' '.NetworkSettings.Ports' '\"8080/tcp\"' '0' '\"HostPort\"\}\} jenkins
  register: port
comments powered by Disqus


I'm Ade Slade, a PHP web developer.