Skip to content

Instantly share code, notes, and snippets.

View abhilashshettigar's full-sized avatar
🎮
Game on

Abhilash Shettigar abhilashshettigar

🎮
Game on
View GitHub Profile
@abhilashshettigar
abhilashshettigar / autostart-container.sh
Created March 27, 2023 05:51
This is a simple script to AutoStart the docker container if the docker restart policy is not working properly
#!/bin/bash
CONTAINER_NAME="your-container-name"
if [ ! "$(docker ps -q -f name=$CONTAINER_NAME)" ]; then
if [ "$(docker ps -aq -f status=exited -f name=$CONTAINER_NAME)" ]; then
# Start the container if it is stopped
docker start $CONTAINER_NAME
fi
fi