Using docker in this way

I have a cloud dedicated server running ubuntu 16. I want to run some software that requires jdk and requires java_home to have been set. The software also requires nodejs and npm package manager. I am new to docker and i require assistance to figure out whether docker can be used in this way.

I create a docker image install nodejs,npm,jdk in it and also set the paths, then use this docker image in my ubuntu dedicated server?.

Will the paths set i he image still hold if i decide to use the image in any dedicated server running ubuntu 16?