How to compile from a remote machine ?

I have Debian Wheezy, and I’m looking for gcc 4.8 which is not include in the stable version.I don’t want to pass to Wheezy unstable or test. so, I looked for a solution, and I found two.

First, I make a local installation (installation for only a one user) by using the source code, but there is a problem of dependency. I don’t know if it is possible to make local installation via apt-get ?

  • Creating docker-consul official image
  • Automatically create docker container and launch python script
  • Can I make memory savings with docker by using a common image?
  • Gitlab Runner fails creating android build using the newer yml format
  • Restoring to a neo4j docker container
  • In docker container connect from inside to local apache not happening
  • Second, and for it I made this post, I installed docker with Ubuntu. I installed on all tools that I need. Now I want to know if there is method to call gcc 4.8 installed in my docker’s Ubuntu to compile software in my Debian ?

    I can’t do the inverse, compiling in Ubuntu then move the result to Debian, because the compilation will be done several times , it’s a project which I develop and It uses Qt5. also, it’s not difficult to run Qt5 from Docker container.

    thank you.

  • Unable to run shell command with docker?
  • How to mount docker volume into my docker project using compose?
  • Docker - getting disk quota exceeded while pulling image
  • Put docker0 behind NAT
  • Downloading Gradle in Docker Container
  • Docker java api maven Build error: busybox is an unrecognized image. Please pull the image first
  • One Solution collect form web for “How to compile from a remote machine ?”

    Does the example below help? Its for a single file but you can apply the same technique to a full project. Mount the source and output directories (which may be the same) into the container as volumes. Then run your compile inside the container.

    # In debian host
    mkdir -p /files/src
    mkdir -p /files/target
    # copy src files to /files/src 
    # Run the compile in docker (ubuntu)
    docker run -v /files/:/tmp/compiler/src -it you/your-container \
           gcc /tmp/compiler/src/ -o /tmp/compiler/target/file.o
    # In debian again
    ls /files/target/file.o
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.