Docker Community Forums

Share and learn in the Docker community.

Is it possible to write code locally and build it in docker image using any IDE?

I have been playing around with the Docker extension for VSC and reading the documentation. So far what I have achieved is attaching to a docker container and modifying code inside that is later built.

The way I have it now I have two options:

a) Build the container, attach to it, and edit and build there, but being careful not to exit it or else all progress will be lost. b) Edit it locally and build the image every time and run the container. With this option I have to compile the whole project every time.

What I would like to do, however, is to be able to write code locally and when I want to build it “copy” it inside a container, the build environment where all the dependencies are, so that if I have already compiled it before throughout the day only the new changes have to be compiled.

Do you know if it’s possible to get something like this working, either with VSC or another tool? Thanks for your help

You can share folders between your container and the host. Use a git control to manage the versions of your project. If you are thinking about IDE, I would personally suggest gdbgui. However, it depends on what application you are trying to build on docker. It would be easier if you can build and debug it on your host and when it is almost finished you can transfer it to docker.

Oh that sound’s interesting. So I can have my src files locally and edit them but they will also be changing inside the docker container?