Posts Tagged ‘Docker’

How to tell if you’re in a docker container

Sometimes you need to know if you’re inside a docker container from the shell. Here’s how you can do that.. First spin up a container.. docker run -ti –rm ubuntu You can perform a cat on the cgroups section of your process in /proc. N.B. self means the calling process… cat /proc/self/cgroup In a docker […]

“could not open session” error in docker container

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 […]

A dockerized mongod instance with authentication enabled

Here’s just a quick walkthrough showing how to create a dockerized instance of a standalone MongoDB instance. First, from within a terminal, create a folder to hold the Dockerfile… mkdir Docker_MongoDB_Image cd Docker_MongoDB_Image touch Dockerfile Edit the Dockerfile… vi Dockerfile Enter the following text. You may wish to modify the file slightly. For example; if […]