Created
February 16, 2025 21:17
-
-
Save larkinwc/80d35db5931644412afea663a73d97a5 to your computer and use it in GitHub Desktop.
Script to fix docker running in WSL if it crashes and won't start again with the message "/etc/init.d/docker: 62: ulimit: error setting limit (Invalid argument)"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if script is run as root | |
if [ "$EUID" -ne 0 ]; then | |
echo "Please run as root (use sudo)" | |
exit 1 | |
fi | |
echo "Setting ulimit..." | |
ulimit -n 524288 | |
echo "Starting Docker service..." | |
service docker start | |
# Check if Docker started successfully | |
if [ $? -eq 0 ]; then | |
echo "Docker has been started successfully!" | |
else | |
echo "Error: Docker failed to start" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If ulimit is not found, try running
sudo su
and executing again.