GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docker-exec.github.io — Docker Exec What?Docker Exec is a collection of Docker images capable of executing code in many different programming languages without requiring a single compiler or script interpreter on your machine. The See the dexec installation guide to get started
Let's take a closer look at one of the examples, helloworld.cpp: #include <iostream> int main() { std::cout << "Hello, World!" << std::endl; return 0; } executing it is simple:
Docker Exec also supports passing arguments to the executing program, passing arguments to the compiler, mounting extra files and directories in the executing container as well as the ability to make source files executable as scripts using a shebang. Why?Docker Exec allows you to run code in a compiled language just as easily as you can for interpreted languages. This is useful for speeding up your ability to try things out in compiled languages. The uniform interface used to execute source for all of the different languages means that calls to Another benefit is that the only dependency on your machine becomes Docker instead of lots of different compilers and interpreters. Docker is a powerful tool and a lot is said about its potential for running web services and databases. However, it's also great for single program execution too and this is an example of how tools can be usefully virtualised just as well as web services. Further to this, the virtualisation of the compilation and execution acts as a sandbox in the event you're not entirely sure how safe a piece of code is to run. How?A Docker image exists for each target language, with an associated automated build job on Docker Hub. The image contains the compiler, runtime or interpreter for that language and a bash script that does any of the following depending on the language:
The $ docker run -t --rm \
-v $(pwd -P)/foo.cpp:/tmp/dexec/build/foo.cpp \
dexec/lang-cpp foo.cppArguments can be passed to the executing code using:
Arguments can be passed to the compiler (if the language has one) using:
Extra file and folders can be mounted in the container with
Prefixing a source file with a shebang that invokes dexec will make it executable:
Where?Which?The following languages are available:
Who?I'm Andy Stanton (@andystanton). Help!Documentation can be found and issues raised in each image's repository. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |