microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
160.96k stars 28.24k forks source link

Docker code sync issue #182144

Closed mastarke closed 1 year ago

mastarke commented 1 year ago

Does this issue occur when all extensions are disabled?: Yes/No

Steps to Reproduce:

I have installed the remote ssh extension as well as the docker extension. The work flow I have is to enable the ProxyCommand to go from remote server one to remote server two and then on remote server two there is a docker container running there. On that docker container on remote sever two I enter the docker container and open my python file. If I make changes there some reason they seem to get saved but somehow vscode is not aware of the changes.

For example one thing I did is open one file I was working on in that docker container I inserted a pdb breakpoint into the script. Then ran it locally and that is fine. Then what I did is on vscode I opened that same file I could see my pdb breakpoint in the code, I actually deleted the entire contents of the file and saved it. After that I ran the script and still somehow even with an empty file I am still hitting the pdb break point even though I deleted the contents of the file and its completely blank.

The thing that is confusing here is that if I go to the file on the remote server and enter the docker container I also see locally that file is empty so not sure if vscode is running some cached version or what but somehow things are out of sync.

mastarke commented 1 year ago

Ok Kind of have an idea what is going on here but still unsure why its behaving like this. Some reason when i open the files in vs code it saves them as room, however if you see in my ssh config file i should be logged in as the user vxr. If you see the file my_script.py before making any changes the file belongs to vxr then i open the file on vscode save it and now the file changed to root from there i get in the behavior as previously mentioned in the description

ssh config file parameters

Host slurm_inter HostName server1 User user1

Host sonic_mgmt HostName server2 User vxr ProxyCommand ssh -q -W %h:%p slurm_inter

originally the file belongs to vxr

vxr@vxr-vm:/data/tests/vlan$ ls -ltr total 48 -rw-rw-r-- 1 vxr vxr 8526 Apr 21 01:59 my_script.py

i saved the file in vscode and now the file belongs to root? not sure why as in my ssh config its mentioned to be user as vxr

vxr@vxr-vm:/data/tests/vlan$ ls -ltr total 36 -rw-r--r-- 1 root root 0 Apr 21 01:59 my_script.py

Also you can see when I attach to the docker container and run whoami from vscode it shows me as the correct user but yet its saving the file as root ?

vxr@vxr-vm:~$ whoami vxr