In my searched there is a post on this forum to which someone mentions; you can run docker on a remote server. Although the instructions were not clear, my goal is to run docker on a remote server from Windows Sub-system for Linux, how can I run docker containers or run docker from within WSL ?
Easiest way is to install only the Docker CLI inside WSL and point it at the remote engine over SSH. Nothing has to run locally.
# docker-ce-cli comes from Docker's apt repo
sudo apt install docker-ce-cli
docker context create remote --docker "host=ssh://user@your-server"
docker context use remote
docker ps
For that to work you need key-based SSH to the server (ssh user@your-server should log you in without a password prompt), and that user has to be in the docker group on the server.
Two things that catch people out: bind mounts like -v ./data:/data refer to paths on the remote server, not your WSL disk, and published ports open on the server too, so you browse to the server’s IP, not localhost. docker context use default switches you back.