Skip to content

Instantly share code, notes, and snippets.

@Michael-Stokoe
Created January 21, 2020 15:39
Show Gist options
  • Save Michael-Stokoe/c858eb8ee1b14e87d6edb6b90cd62c5e to your computer and use it in GitHub Desktop.
Save Michael-Stokoe/c858eb8ee1b14e87d6edb6b90cd62c5e to your computer and use it in GitHub Desktop.
# Add these lines to your .bashrc to automatically start Docker in WSL/WSL2.
function docker_startup() {
i=`ps -eaf | grep -i docker |sed '/^$/d' | wc -l`
if [[ $i > 1 ]]
then
echo "Docker is already running."
else
sudo service docker start
echo "Docker started!"
fi
}
docker_startup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment