microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.68k stars 296 forks source link

Setup and Configuring .devcontainers configuration file #10438

Open SheepDomination opened 3 weeks ago

SheepDomination commented 3 weeks ago

I'm trying to setup the .devcontainers file as I want to modify an active running containers file. Therefore I ran the command; Dev Containers: Add dev containers configuration file. Although I did not know which options to choose when creating this configuration file. Therefore I created a docker outside of docker configuration file.

I understand that if I want visual studio code to access docker remotely I have to setup docker.host which I've done along with ssh into the correct remote host. I'm not aware if there is anything more that should be added but the following to the settings.json file ?

"docker.host": "ssh://[remoteHostName@HostName]"

The .devcontainers configuration setup and what should be added or removed based on the configuration file which I created is what I do not understand ?

chrmarti commented 3 weeks ago

Instead of setting "docker.host" it is usually better to use the Remote-SSH extension to connect to an SSH server and then use the Dev Containers extension to create and connect to a devcontainer on the SSH server. Can you use that? (https://code.visualstudio.com/remote/advancedcontainers/develop-remote-host)

SheepDomination commented 3 weeks ago

Instead of setting "docker.host" it is usually better to use the Remote-SSH extension to connect to an SSH server and then use the Dev Containers extension to create and connect to a devcontainer on the SSH server. Can you use that? (https://code.visualstudio.com/remote/advancedcontainers/develop-remote-host)

Identical to this; https://www.bing.com/ck/a?!&&p=bac91ad45284d1ee23b5f04682713cf4fdd7ed1c47485f70f765953a7a5bf772JmltdHM9MTczMDU5MjAwMA&ptn=3&ver=2&hsh=4&fclid=1a8bc5f4-4086-6aff-0cad-d0fb412c6b66&u=a1aHR0cHM6Ly9jb2RlLnZpc3VhbHN0dWRpby5jb20vZG9jcy9jb250YWluZXJzL3NzaA&ntb=1

Although I don't quite understand devcontainers and their purpose once you are connected to a container. I understand you log into SSH and you tell vccode where docker exists, from that point where does devcontainers help ?

chrmarti commented 3 weeks ago

Dev Containers captures the configuration needed to create and connect to a container for development and makes Git credentials, ssh-agent, gpg-agent and X11 / Wayland displays available inside the container. We also provide base images for many of the most common programming languages and technology stacks, so you don't have to start from scratch.

SheepDomination commented 2 weeks ago

Dev Containers captures the configuration needed to create and connect to a container for development and makes Git credentials, ssh-agent, gpg-agent and X11 / Wayland displays available inside the container. We also provide base images for many of the most common programming languages and technology stacks, so you don't have to start from scratch.

When creating a Dev Container Configuration File what options much I choose as there are many when creating the file before the file is actually created ?

This is when connecting to docker remotely though a CLI which case the environment variable docker.environment is required ? Otherwise it's not required if you don't want to access file in a CLI within a docker container and open it in vscode ?