I am using VSCode in my local PC and connecting to a Docker container in a remote server with VSCode's Extensions of Remote - SSH
and Remote - containers
. However, when I type
$ code <file name>
on the VSCode's terminal (Bash), I get an error messages saying that
bash: code: command not found
and I can't edit the file on the VSCode's editor.
If I click on the file from VSCode's Explorer (Ctrl+Shift+E), the edit screen will appear, but isn't it possible to call it with the code
command?
Also, I call the command palette (Ctrl+Shift+P) and then search for Shell Command: Install 'code' command in PATH
but no matching commands are found.
The execution environment is as follows:.
Thank you very much for your answer.
I'll answer myself as I was able to call VSCode using the code
command in the remote's container.
When I look closely underneath home, I see that there was a code
at the following directory.
$HOME/.vscode-server/bin/<directory with a hash-like name>/bin/
So I passed the PATH through it and it worked.
By the way, <directory with a hash-like name>
is a directory with a hash-like name, which is randomly assigned when you connect to the container remotely. It's different every time, so please refer to it by yourself.
The way to register the path is as follows.
export PATH="$PATH:$HOME/.vscode-server/bin/<directory with a hash-like name>/bin/"
Thank you very much for your support.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With