/vscode-remote_dev-config_test

A guide to use a docker-based remote development environment, accessible from anywhere with a simple Visual Studio Code client that requires minimal setup.

Primary LanguageDockerfile

Setting a docker-based remote development environment using Visual Studio Code.

We'll be setting a docker-based remote development environment, which will pretty much replace in full your local environment, so a laptop with a fresh installation of Visual Studio Code, an SSH access to a Docker Host, and the appropriate config files; can start developing out-of-the-box.

This how-to hasn't been widely tested, for any questions please refer to the main documentation.

Found it useful? Give it a

Feel free to update this repo with your findings by sending a pull-request.

This process has been tested in the following environment:

Steps to follow:

In your local environment:

  1. Install vscode.
  2. Install the Remote Development extension in VSCode
  3. Install the Docker Desktop.

In your remote server:

  1. Install Docker.
  2. Install Docker Compose.

In your local environment:

  1. Open this repository with your local VSCode, and refrain from clicking Open in Container.
  2. Tweak .devcontainer/devcontainer.json appropriately.
Note that you have three different options to create your dev docker container (to chose one just uncomment that section in .devcontainer/devcontainer.json, and comment the others):
- **Use a DockerHub image.**
- **Use a Dockerfile.**
- **Use Docker Compose:** If using this option you'll need to adjust all docker-compose*.yml files.

    ##### Notes on performance
    Some times Docker can try to consume too much memory, causing an Out of Memory (OOM) issue, that might cause your server to freeze until the OS kills docker. To avoid this you'll need to limit the resources your docker containers can consume.

    For **Docker Compose** you'll need to use version 2, and include resource limits (version 3 won't work as it requires Docker Swarm): mem_limit.
    For **Dockerfile** and **DockerHub image** user runArgs (commented line included in .devcontainer/devcontainer.json).
  1. Create an SSH tunnel form your local to your remote environment Using PowerShell in Windows, it'll look like: ssh -NL localhost:23750:/var/run/docker.sock <your_remote_host>
  2. Now, everything is ready, go to VSCode, press Ctrl + Shift + P and hit Remote-Containers: Open Folder in Container...

If everything worked fine your container will now be created, and in a few moments you'll be ready to start developing in your