Check if the process is running inside a Docker container
npm install is-docker> Check if the process is running inside a Docker container
``sh`
npm install is-docker
`js
import isDocker from 'is-docker';
if (isDocker()) {
console.log('Running inside a Docker container');
}
`
`sh`
$ is-docker
Exits with code 0 if inside a Docker container and 2 if not.
`sh``
$ is-docker && echo "Running in Docker" || echo "Not running in Docker"
- is-inside-container - Check if the process is running inside a container