Erratic behaviour upon connecting to remote Docker host
Hi. When trying to connect to a remote Docker host, I get one of the following errors every other day, and every other day connecting works fine. I have set "docker.host":"ssh://your-remote-user@your-remote-machine-fqdn-or-ip-here" and the exact same problem arises on 3 clients (2 Windows 10 and 1 Ubuntu 18.04), all trying to connect to a Docker host on a Ubuntu 16.04 server. Errors:
- command 'remote-containers.attachToRunningContainer' not found
- Current user does not have permission to run 'docker'. Try adding the user to the 'docker' group.
I have added the user to the 'docker' group. Many thanks for your help.
Is there anything in the log at that point? (F1 > Remote-Containers: Show Log)
Or the developer console? (Help > Toggle Developer Tools)
Thanks for the advice @chrmarti. I don't see Remote-containers: show log. I can see Docker Containers: View Logs, but it only gives me the option to install Docker or troubleshoot. I have Docker Desktop running. This is so odd. When I look at the output in Developer tools after uninstalling/installing remote-containers, I see
[Extension Host] Sync: Extensions changed
abstractExtensionService.ts:396 Activating extension 'ms-vscode-remote.remote-containers' failed: ENOENT: no such file or directory, open 'C:\Users\avesu\.docker\ca.pem'.
_logMessageInConsole @ abstractExtensionService.ts:396
console.ts:137 [Extension Host] Sync : Connected with user : 'AVSuni'
notificationsAlerts.ts:38 Error: command 'remote-containers.settings' not found
at u._tryExecuteCommand (commandService.ts:80)
at commandService.ts:73
at processTicksAndRejections (internal/process/task_queues.js:89)
at async t (commandsHandler.ts:324)
onDidNotificationChange @ notificationsAlerts.ts:38
Any idea why it looks for C:\Users\avesu\.docker\ca.pem? Do you have the DOCKER_CERT_PATH environment variable or the "docker.certPath" setting set?
Ha! I did have DOCKER_CERT_PATH set. I must have tried it and forgotten it. Now I get current user does not have permission to run 'docker'. Try adding the user to the 'docker' group I am in the docker group and can use docker normally from the terminal on the remote machine. Also, the "old way" of using ssh -NL localhost:23750:/var/run/docker.sock user@server gives Permission denied. sudo chmod 666 /var/run/docker.sock makes no difference
Where does permission denied originate from? Does ssh user@server still work? Is localhost:23750 already in use?
Thanks @chrmarti. I can't get see anything in the logs. Also bizarrely, I have three laptops, all with identical settings.json and SSH config files. I can connect to running remote containers with one of them (Windows 10), but not with the other two (Windows 10 and Ubuntu 18.04). All three are able to connect with ssh user@server as usual. I haven't set other environment variables on any of the machines. They only have docker.host set in settings.json
A quick update. The issue has not been solved, but I was just comparing the settings.json files between the two Windows machines (one of which is able to connect to remote Docker). The files are (still) identical, but the machine that cannot connect tells me that "docker.host": "ssh://user@server" is an "Unknown Configuration Setting"
EDIT: That was due to missing Docker extension. Installing it made no difference. I must say this is one of the most annoying issues I have faced in some time. I can't tell any difference between configurations of the machines
UPDATE: I'm embarrassed to admit, but I had not added the SSH keys to the SSH client. Problem solved by ssh-add private_key