Vscode-remote-release: Support for Docker Machine

Created on 3 May 2019  路  12Comments  路  Source: microsoft/vscode-remote-release

Issue Type: Question?

Hi,

I'm currently using Docker Machine to boot up and manage a VM that I connect to for local development (instead of Docker for Mac).
How do I go about connecting Remote Containers to it? Is it currently compatible?
Currently, trying to run "Attach to Running Containers" returns the error "Docker returned an error".

image

Extension version: 0.48.0
VS Code version: Code - Insiders 1.34.0-insider (473af338e1bd9ad4d9853933da1cd9d5d9e07dc9, 2019-05-01T00:21:48.884Z)
OS version: Darwin x64 17.7.0


System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-6660U CPU @ 2.40GHz (4 x 2400)|
|GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled|
|Load (avg)|3, 3, 4|
|Memory (System)|16.00GB (0.87GB free)|
|Process Argv|-psn_0_4281365|
|Screen Reader|no|
|VM|0%|


containers feature-request

Most helpful comment

This is not well tested: Try running eval "$(docker-machine env your-docker-machine)" before you start VS Code and then start VS Code from that same terminal.

All 12 comments

This is not well tested: Try running eval "$(docker-machine env your-docker-machine)" before you start VS Code and then start VS Code from that same terminal.

I would also be interested in the feature, in the meantime I can confirm that the workaround mentioned above works successfully also with VS Code 1.33.1 for Windows.

@cameronmaske @dreamorosi We've documented how this can be done now here: https://code.visualstudio.com/docs/remote/containers-advanced#_developing-inside-a-container-on-a-remote-docker-host

Hi, I'm working on creating a separate script that allows using docker-machine with vscode (in my case this means working on a linux desktop from my windows laptop).

Here's the script gist:

https://gist.github.com/MichalCz/74a0b2e6a91ace8ed0d549e62258c609

I'm currently stuck on getting the proper filesystem mapping working, here's what I already got:

  • remote host resolution to support dynamic IP for docker-machione - the machine is regenerated on every IP change
  • setting up local config path to a special path so that the docker-machine environment doesn't interfere with the local one
  • sourcing the local environment from docker-machine.

I previously used docker-machine this way from linux and that worked perfectly with an additional ssh mount by docker-machine, but that sadly is not supported by windows docker. I think there is a good way to solve that though: I'd like to use ssh forwarding and smbd running in foreground on a vscode specific configuration.

So maybe someone would be willing to help?

BTW, the linux-linux version works amazingly well. :)

@trowbridgec

Couple additions about the setup:

  • the workspace folder is located on the remote machine - there may be a simple solution to all this, simply run a sftp server on Windows (or even within vscode) and mount remotely over ssh forwarded local sftp port?
  • the server name needs to be somehow resolvable (currently avahi is working on linux, but I don't know about windows)
  • the good thing about using linux as file host is no problem with file permissions - so maybe some synchronization would be also an option.

@MichalCz If you have not already, several of the things you describe are outlined in the advanced containers documentation. The steps described work regardless of from mac/Windows/Linux to Linux. They could work any OS to a Windows or macOS remote Docker host in theory, but Docker Desktop is not really set up to act as a remote host.

One of the later sections describes how you can use SSHFS to store the devcontainer files remotely as well. If you want the source code available both locally and remotely, I wouldn't reccomend a file mount for anything major due to latency issues. Using rsync is a better option.

I should also add that many features have landed that makes doing this easier than it was originally including support for docker properties in settings.json. We also enabled Docker contexts to support the Docker WSL2 tech preview

@Chuxel I'll try checking the remote setup in settings.json (although the defaults seem to come from env anyway). As to the mounting - I thought of a workaround of not being able to get the .devcontainer/devcontainer.json file resolved to start a new checkout - I can't get this working when connecting to a remote machine over ssh.

Thanks for the great discussion in this thread. Based on the suggestions above and the documentation here https://code.visualstudio.com/docs/remote/containers-advanced#_connect-using-docker-machine, it appears this question has been answered, so closing this issue. Please feel free to let me know if I might have missed something or if you have any other questions or feedback!

Was this page helpful?
0 / 5 - 0 ratings