docker inspect and jq
While using kamal, some of my mounts weren't working as expected. Search engines were a little bit unhelpful in determining what was going on, and I muddled my way through. I'm posting this in hopes that it makes search engines more helpful for future-me or future-someone-like-me.
More seasoned docker veterans probably wouldn’t have needed to turn to a web search to figure this out, but I’m not a seasoned docker veteran. I’m a greybeard who’s uded to hosting things on regular systems the regular way, and I’m still adapting my troubleshooting techniques to docker :-).
Part of my challenge was that kamal was providing a (useful but rather new-to-me) layer of indirection. So when volumes I asked it to mount were not showing up, it was a not intuitive to gather more information. docker inspect is extremely helpful, but reading its output in my ssh session was ugly, and copying the output back to a local system that would format that was a pain.
docker inspect <container> |jq '.[].Mounts' worked so much nicer than having filter flags on the inspect command would’ve.
$ docker inspect 62fa78f69f98 |jq '.[].Mounts'
[
{
"Type": "bind",
"Source": "/srv",
"Destination": "/srv",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
}
]
Finding how to do that was worth the pain of fumbling around. I hope posting it brings it higher up the search results for those who need to do similar things. Like, probably, future-me.
Also, this is probably an argument for making sure jq is installed on your VPSes that you use to host containers.