I’d like to use this droplet as remote Docker server for VSCode development, I have Windows 11 with WSL2. If it is easy, I’d like next level - set up Windows Docker Desktop pointed to your(my) server
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey!
Yep, that is doable. You would need to first set up remote access for Docker daemon on your Droplet as described here:
Here is a quick overview of what you need to do:
Install Docker
Configure Docker for Remote Access on the Droplet
<your_droplet_ip>
with the Droplet’s IP address:Note: By enabling remote access over TCP, your Docker server is open to anyone with your IP and port 2375. You should use a firewall or SSH tunneling to secure the connection. Here’s how to set up a firewall on DigitalOcean and close port 2375 for public access and only allow your IP:
Install VS Code Remote - Containers Extension
Configure Docker CLI in WSL2 for Remote Docker Host
.bashrc
or.zshrc
in WSL2 and add this line to point Docker commands to your remote server:Use Docker Desktop with Remote Server
This setup allows VS Code and Docker Desktop to communicate with the remote Docker instance on your DigitalOcean Droplet for containerized development.
Make sure to secure the Docker socket, especially if using it over the internet, by setting up a firewall or considering SSH tunneling for added security!
- Bobby
Heya,
The instructions for the setup are pretty much covered by KFSys. Here are some important topics to note as well.
Docker Desktop on WSL2 offers native Docker support for a seamless experience on Windows. You can develop locally on Docker Desktop and only push containers to the droplet when needed. This approach keeps development fast and responsive, with the option to deploy easily on your DigitalOcean instance.
You can use TLS to encrypt connections to the Docker API. This requires creating certificates for the Docker daemon and configuring Docker Desktop and VSCode to use these certificates. This setup keeps your connection secure but adds a bit of complexity to the initial configuration.
Rather than exposing the Docker API on an open port, set up an SSH tunnel. You can create an SSH connection from your local machine to your droplet and then connect VSCode and Docker Desktop through this tunnel. This keeps Docker accessible only to your local machine, reducing exposure risks.
For example, you can create an SSH tunnel like this on your Windows machine:
Then, in VSCode or Docker Desktop, point to
tcp://localhost:2375
.Regards
Heya,
By default, Docker only listens to local connections for security. You’ll need to configure it to accept remote connections.
Add the following configuration, replacing
YOUR_IP
with your droplet’s IP address:Create and Install TLS Certificates: You’ll need to generate TLS certificates to securely connect to Docker remotely.
On the droplet:
after that restart Docker
2. Install Docker Desktop and Configure for Remote Connection
Expose daemon on tcp://localhost:2375 without TLS
.3. Configure VSCode for Remote Docker Development
Ctrl+Shift+P
), then select Remote-Containers: Attach to Running Container.4. Connect to Docker Desktop from VSCode
Now, in VSCode, open the Docker extension and select Connect to Host using the IP of your droplet with port
2376
. With Docker Desktop configured for remote development, you can seamlessly work with containers on your DigitalOcean server while managing from your local machine.Let me know if you’d like help with further configurations or any troubleshooting tips!