I received the following error, attempting to cat a log file, inside a docker contain when troubleshooting another issue…

TASK [setup_cassandra : shell] *************************************************
changed: [testhost] => {"changed": true, "cmd": "cat /var/log/cassandra/*", "delta": "0:00:00.004140", "end": "2019-03-16 18:48:28.684133", "rc": 0, "start": "2019-03-16 18:48:28.679993", "stderr": "", "stderr_lines": [], "stdout": "could not open session", "stdout_lines": ["could not open session"]}

A bit of googling suggested the use of the –privileged flag of the docker command. I was using the ansible-test tool, which invokes docker, so the equivalent flag was –docker-privileged

test/runner/ansible-test integration -v cassandra_backup --docker centos6 --docker-privileged

This flag then allowed me to continue with my troubleshooting.