VSCode remote-containers.attachTorunningContainerFromViewlet error - docker

I'm using Remote-SSH to connect to a remote, and then Attach Visual Studio Code on the remote host gives me an error.
[2022-01-12 16:59:07.497] [exthost] [error] Shell server terminated (code: 255, signal: null)
enter code here
ssh: Could not resolve hostname local-88-centos0-frp: No such host is known.
remote-containers.attachToRunningContainerFromViewlet {"value":"ms-vscode-remote.remote-containers","_lower":"ms-vscode-remote.remote-containers"}

I also met this problem on my computer when I tried to connect our lab server:
But others' computers didn't pop up this error when they tried to connect to remote-containers.
Shell server terminated (code: 255, signal: null)
ssh: connect to host xxx.xxx.xxx.xx port 22: Connection refused
OK finally I find the solution, it maybe a bug on vscode Remote - SSH extension.
click extension
click Remote-SSH and right click setting
find Remote.SSH: Config File (The absolute file path to a custom SSH config file.)
please leave this setting empty and it is the default at .ssh/config, please modify at there but no input here.
Then I found my problem solved.... Hope it's can help people who met same problem as I did.

Related

How to solve the issue of 'Unable to connect to the server: EOF' Kubernetes failed to start

I am using Docker for Desktop with version 20.10.17. Whenever I try to enable Kubernetes v1.24.2 from Docker Desktop and then click on apply and restart, it shows "Kubernetes failed to start". Moreover, when I type kubectl version in cmd, the version for client is shown but for server it displays "Unable to connect to server: EOF". I have tried a number of solutions including purging and resetting from troubleshooting option of docker desktop. I have disabled VPN, firewall but nothing is helping me. Can anyone help me overcome this problem?

Setup new connection in mysql workbench using standard TCP IP over SSH

Could not read the contents of .ssh directory.
Error opening directory '/home/[username]/.ssh': Permission denied
I can see in the list of running processes that mysql-workbench is not running as root user.
I am not sure what the actual issue is. I only want to load '/home/[username]/.ssh/id_rsa' file while adding parameter in 'SSH key file' during connection setup. So that my connection should be established successfully.
Presumably you're on Ubuntu. I had this problem too and https://askubuntu.com/a/1271919/48214 was the solution for me.

ECONNREFUSED 127.0.0.1:80 when connecting to remote Docker with Visual Studio Code

I want to develop code inside a container on a remote Docker host with VS Code, but I cannot connect to Docker on the remote machine via SSH (ECONNREFUSED 127.0.0.1:80).
Following the VS Code instructions to use a SSH tunnel (https://code.visualstudio.com/docs/remote/containers-advanced#_option-2-connect-using-an-ssh-tunnel) I got this error:
"Unable to connect to Docker. Please make sure you have installed
Docker and that it is running. Details: connect ECONNREFUSED
127.0.0.1:80"
I started VS Code (Windows 10), updated the docker.host (File->Preferences) property to:
{
"docker.host":"tcp://localhost:23750"
}
and ran:
ssh -NL localhost:23750:/var/run/docker.sock user#hostname
It looked like established the tunnel successfully. I run Docker on a virtual machine (centOS).
When I opened the Docker view and expanded the Containers node in the explorer I got the above mentioned error. To me it looks like VS Code tries to connect to port 80 but I specified port 23750 in the settings. How can I successfully connect to the remote host?
I found a fix here: https://github.com/microsoft/vscode-docker/issues/580
Remove the prefix tcp:// from the docker.host settings, e.g.:
"docker.host": "localhost:23750"
I know that this question is old but for anyone still looking for options I solved a similar issue on my computer using IPv6.
So in your case:
{
"docker.host":"tcp://[::1]:23750"
}
I configured the host on the environment variable DOCKER_HOST.

Jenkins ssh: Recover deleted ssh known host or recreate it?

Recently I got an error doing ssh to another remote server from Jenkins pipeline. I forget to save all the log but here's a part of it
###########################################################
# WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! #
###########################################################
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
In the error log, there's a suggestion to run this command to fix it
sudo ssh-keygen -f "/var/lib/jenkins/.ssh/known_hosts" -R "<<remote ssh ip>>"
so I ran it.
Previously some remote ssh command does run before it returns an error.
But now it seems can't connect to the remote at all, the remote ssh command fails from the beginning.
Failed to add the host to the list of known hosts (/var/lib/jenkins/.ssh/known_hosts).
from How can I get rid of " WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!" I tried running ssh-keygen -R <<remote ssh ip>> but the error still appear.
How can I recover the deleted line? or recreate a new one?
First, you have to understand what the message means before you "get rid of it".
The message means the destination server has changed its identity or someone is hacking you man-in-the-middle like and the server you are trying to reach, is not the server you think it is.
So first of all you must make sure there is no man-in-the-middle hack going on.
Then, you go into the known_hosts file and delete just the line with the server you are about to connect to.
After saving, you get asked wether you want to trust the server or not just as a connection to a yet unknown host.

PyCharm cannot use interpreter in local docker-machine

I am using windows 10 professional and I have installed docker using DockerToolBox, so I have a docker-machine running in VirtualBox. When trying to configure an interpreter in PyCharm using my docker-machine, I get the following error:
"Cannot connect: java.lang.NullPointerException: uri was not specified"
docker-machine error
When I choose 'TCP socket', I get the following error which is different from above:
"Cannot connect: java.io.IOException: Channel disconnected before any data was received"
TCP socket error
I am sure my docker-machine is running because I can connect to it using terminal tools like MobaXterm or XShell, and I can also connect to MySQL running in my docker-machine.
Replacing tcp:// by https:// in the api url works for me in Webstorm (Windows 8.1).
https://github.com/kubernetes/minikube/issues/580
I have tried thousands of methods, and finally resolved this problem. The solution is running pycharm as administrator. WTF
I have same issue.
You must check Pycharm logs. There is detailed information about error.
In my case Pycharm shows same error "Channel disconnected before any data was received".
But in logs i found that error is caused by:
"ERROR - HttpResponseStreamHandlerFixed - exceptionCaught before first read or disconnect, we may be hanging
io.netty.handler.codec.DecoderException: javax.net.ssl.SSLHandshakeException: No name matching "my_server_hostname" found"
In my case, the problem was that domain name that i connecting to is in not the same as hostname in SSL self signed cert installed in dockerd.
Domain name that you are connecting to must match domain name in SSL cert that dockerd uses.
I have to make hosts record (C:\Windows\System32\drivers\etc\hosts on Windows, and /etc/hosts on Linux) and connect to it.
And "https://" protocol is required :)
PS. You can check SSL cert hostname by opening Chrome browser to the docker API endpoint with https and opening certificate details.

Resources