For a system validation (using goss
) I want to check if a particular Docker container is running. The command
docker ps -a --format '{{.Names}} {{.State}}'
gives me the output I want, but when I put it into a goss
check
command:
foo_status:
exec: docker ps -a --format '{{.Names}} {{.State}}'
exit-status: 0
stdout:
- foo running
timeout: 5000
I'm getting the following error:
Error: template: test:52:36: executing "test" at <.Names>: can't evaluate field Names in type *goss.TmplVars
I tried escaping the curly brackets with backslashes
command:
foo_status:
exec: docker ps -a --format '\{\{.Names\}\} \{\{.State\}\}'
...
but that doesn't seem to work either, because now I'm getting the error that the pattern can't be found:
Failures/Skipped:
Command: foo_status: stdout: patterns not found: [foo running]