microsoft / VSLinux

VS extension for C++ Linux development
205 stars 34 forks source link

Support Building / Running with Docker for Windows #48

Closed simonferquel closed 4 years ago

simonferquel commented 8 years ago

Docker now provides Windows users with Docker for Windows that basically hides all the complexity of running a Linux host on Hyper-V, sharing files between Windows and the linux containers etc.

One very good usage of Docker is to use containers to build code using a special purpose container image (or even build code directly from a Dockerfile to benefit from the docker image cache), and run/debug in a container supporting GDB.

It would be really nice to get this experience from Visual Studio. If you need some support or more info from the Docker for Windows team, fill free to contact me.

robotdad commented 8 years ago

Docker has been on my backlog for too long. I just started setting up a container to try this out and I don't see an immediate reason why we can't get this working with the current extension. We just need to setup a container that has our prereqs installed and opens up SSH. That could give us a quick win here.

We could do more I'm sure.

duncangravill commented 8 years ago

This is already possible! I am currently using a Docker container along with Docker for Windows and it is working nicely!

Visual Studio Linux Build Box image on Docker Hub

See my SO post...

http://stackoverflow.com/questions/38960335/visual-c-for-linux-development-docker

Although I'm currently using this Docker image I'm still fairly new to Docker. I'd like to get into the details of the dockerfile to learn more about this particular setup and see if there are any other potential setups...

robotdad commented 8 years ago

Thanks @duncangravill! I will try to make time to try you image tomorrow.

simonferquel commented 8 years ago

Oh, I almost forgot : having this kind of work flows available from VS Code on both Windows and Mac would be very nice as well :)

[edited to trim previous replies above from email reply]

robotdad commented 8 years ago

The machine I was verifying this on had some issues I just straightened out so I was finally able to verify the image above. That is very slick. @simonferquel we should look at getting this promoted into an official repository.

simonferquel commented 8 years ago

The image seems a bit large. I'll try to build a lighter one based on alpine instead of Ubuntu.

Anyway, it is great for a dev/debug/refactoring work flow,  but not for a release one (where we might not want to deploy gdb, opensshserver etc.)

On Fri, Sep 23, 2016 at 8:14 PM +0200, "Marc Goodner" notifications@github.com wrote:

The machine I was verifying this on had some issues I just straightened out so I was finally able to verify the image above. That is very slick. @simonferquel we should look at getting this promoted into an official repository.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

duncangravill commented 8 years ago

@robotdad @simonferquel All credit to D. Ducatel. I imagine there could be many different flavours of linux docker build boxes. Perhaps a Docker repository for a collection of Docker build boxes would be worthwhile, (plus github for community to contribute different flavours) . Personally I wanted to build the most barebones Docker build-box possible (partly as I'm learnig Docker and Linux and it seems like nice simple real world case-study image to learn on), when I first looked at Ducatel's build-box I thought that some of the components of the image might be superflous, on a second look it actaully seems pretty barebones. I'm not sure that git is strictly necessary... Creating an official VSLinux Docker repository would be excellent. But as there could be many different flavours a blog post elucidating building an absolutely barebones Docker build-box would very helpful. Then people could adapt to which ever Linux flavour they wish to develop on.

My interest is in developing a Shared Object library (dependent on other Shared Object libraries), which will be called into from a C# asp.net MVC Core project by means of PlatformInvoke. This setup will be running in a Linux Docker container deployed to Azure Container Services. I've used PlatformInvoke on a similar setup running in Windows Server so hopefully all will go smoothly on Linux.

As I'm learning Docker it seemed natural to me to use a Docker container as a build box. Developing in a build-box which is similar to the container which I deploy my app to may have advantages too. As I'm new to Linux and Docker, Ubuntu seems like a good starting point.

Tip: Use the following Docker command to connect to the build-box container while developing #docker exec -it container_name /bin/bash

itodirel commented 4 years ago

Hi, we have this in the backlog, and we are evaluating native Docker support. Docker can be used over SSH, and we made a recent blog post about it here: https://devblogs.microsoft.com/cppblog/build-c-applications-in-a-linux-docker-container-with-visual-studio/