English
Appearance
English
Appearance
This guide explains how to use WSL Dashboard's startup script feature to automatically run services when your Linux distribution boots.
NOTE
This article covers auto-starting services inside the distribution (auto-starting services such as Docker via a script within Linux). If you want the WSL Dashboard app itself to start automatically when Windows boots, see Configuration Options: Start with Windows.
1. Configure the script hook path
This feature's entry point is in the settings dialog of any installed distribution. Open the settings of your chosen distribution and enter your startup script path in the corresponding input box.

2. Example: Docker container startup script
Here is an example script (init.sh) demonstrating how to auto-start Docker containers and other services.
root@cloud:/home# cat init.sh
#! /bin/bash
# Add a Docker startup log to make troubleshooting easier
LOG_FILE="/var/log/wsl-dashboard-example.log"
echo "$(date): Starting WSL initialization script..." >> $LOG_FILE
# 1. Stop Docker
echo "$(date): Attempting to stop Docker service..." >> $LOG_FILE
cd /home/docker/ && docker compose down >> $LOG_FILE 2>&1
# 2. Start Docker
echo "$(date): Attempting to start Docker service..." >> $LOG_FILE
cd /home/docker/ && docker compose up -d >> $LOG_FILE 2>&1
DOCKER_EXIT_CODE=$?
echo "$(date): Docker startup complete, exit code: $DOCKER_EXIT_CODE" >> $LOG_FILE
# 3. Start any other services
/home/www/apps/hello-go/hello >> $LOG_FILE 2>&1