node.jsdockerdockerfilenetbeans-8

How to setup a development enviroment for working with docker


here is my question, consider the following scenario:

a ubuntu machine, running a dockerized nodejs app.

Dockerfile has RUN instruction to pull the source code from a git repo and run all necessary nodejs/npm command to install the app. CMD instruction starts the app.

Now what I'd need is the possibility to develop via netbeans, in the same way I would do if the source code was in the ubuntu machine (instead of container).

So, how can I develop on ubuntu with netbeans and edit and try code stored inside a container?

I know what docker volume (also mount) is, but it allows to share data from(onto) the host machine. I've already tried to map the local container folder with a host folder, but of course the result was that this mount overide the local container content.


Solution

  • I don't have too much experience at software development.

    But I think for development(before send to the customer), you should build a docker image which base on an official ubuntu baseimage, and add netbeans installations in your dockerfile.

    I don't know if you already read this official doc Get Started,Part2:Containers, maybe it will help you to get start with building your own docker image.

    There are lots of different great dockers made by other developers, like this docker-netbeans image. I just google, not sure for your case is good, suggest you keep google and do some comparation due to your own case.

    After finish the development, you can build another docker image just for sending to customer.

    And about mount, for example

    docker run [other options] -v /local_dir:/image_root_dir/mount_dir image_name
    

    is the way I suggest you to mount your directory, /image_root is created when you build the image, and mount your local directory to a new directory in your new container like here call mount_dir, that will make you able to visit local data or "light-software" on host machine when you are in the docker container.