How to check if a process is running inside docker container?
Docker creates .dockerenv and .dockerinit (removed in v1.11) files at the top of the container’s directory tree so you might want to check if those exist. Something like this should work. #!/bin/bash if [ -f /.dockerenv ]; then echo “I’m inside matrix ;(“; else echo “I’m living in real world!”; fi