Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Podman, and Kubernetes in addition to Docker #48

Open
phreed opened this issue Jun 6, 2024 · 0 comments
Open

Support Podman, and Kubernetes in addition to Docker #48

phreed opened this issue Jun 6, 2024 · 0 comments

Comments

@phreed
Copy link

phreed commented Jun 6, 2024

echo "Checking if running in docker container..."
if [ -f /.dockerenv ]; then
echo "Docker installation detected.";
IS_DOCKER=true
else
echo "Not running in a container.";
fi

The test for /.dockerenv only works for docker containers.
This could be expanded to work for Podman containers as well.

echo "Checking if running in a container..."
if [ -f /.dockerenv ]; then
    echo "Docker installation detected.";
    IS_DOCKER=true
    IS_CONTAINER=true
elif [ -f /run/.containerenv ]; then
    echo "Podman installation detected.";
    IS_PODMAN=true	
    IS_CONTAINER=true
else
    echo "Not running in a container.";
fi

I do not know what the situation is within a Kubernetes POD.

This would, of course require updating all uses of IS_DOCKER to IS_CONTAINER.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant