{"id":12445,"date":"2015-03-29T09:50:00","date_gmt":"2015-03-29T08:50:00","guid":{"rendered":"https:\/\/touk.pl\/blog\/?guid=20dcf310967e572dfbe13def0fde561a"},"modified":"2022-07-27T10:21:11","modified_gmt":"2022-07-27T08:21:11","slug":"all-you-need-is-docker-and-fig","status":"publish","type":"post","link":"https:\/\/touk.pl\/blog\/2015\/03\/29\/all-you-need-is-docker-and-fig\/","title":{"rendered":"All you need is docker (and fig)"},"content":{"rendered":"<div>\n<h1 id=\"introduction\">\n    Introduction<br \/>\n  <\/h1>\n<\/div>\n<div>\n  Suppose you want to run scala repl or groovy shell or any other repl-like executable. You should download executable, unpack it, set PATH environmnt variable and now you could use it. Can it be simple? Yes, dockerize everything.\n<\/div>\n<div>\n  \n<\/div>\n<div>\n<h1 id=\"prepare-containers\">\n    Prepare containers<br \/>\n  <\/h1>\n<\/div>\n<div>\n  I expect that you have installed <a href=\"https:\/\/www.docker.com\/\">docker<\/a>\u00a0and <a href=\"http:\/\/www.fig.sh\/\">fig<\/a>\u00a0on your machine.\n<\/div>\n<div>\n  Checkout <a href=\"https:\/\/github.com\/alien11689\/docker-with-fig\">this project<\/a>\u00a0from github and build containers:\n<\/div>\n<div>\n  \n<\/div>\n<div>\n<pre class=\"brush: bash\">$ cd docker-with-fig<\/pre>\n<\/div>\n<div>\n<pre class=\"brush: bash\">$ fig build <\/pre>\n<\/div>\n<div>\n  \n<\/div>\n<div>\n  It could take several minutes, depends on your internet connection.\n<\/div>\n<div>\n  \n<\/div>\n<div>\n  You could also build only some of available container, for example with scala and groovy:\n<\/div>\n<div>\n<pre class=\"brush: bash\">$ fig build scala groovy<\/pre>\n<\/div>\n<div>\n  \n<\/div>\n<div>\n  Available containers are:\n<\/div>\n<ul>\n<li>haskell<\/li>\n<li>scala<\/li>\n<li>groovy<\/li>\n<li>python27<\/li>\n<li>python34<\/li>\n<li>clojure<\/li>\n<\/ul>\n<h1 id=\"run-containers\">Run containers<\/h1>\n<div>\n  Now you could start for example scala:\n<\/div>\n<div>\n<pre class=\"brush: bash\">$ fig run scala<\/pre>\n<\/div>\n<div>\n<pre class=\"brush: bash\">Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40).<br \/>Type in expressions to have them evaluated.<br \/>Type :help for more information.<br \/><br \/>scala&gt;<\/pre>\n<\/div>\n<div>\n  \n<\/div>\n<div>\n  Or groovy:\n<\/div>\n<div>\n<pre class=\"brush: bash\">$ fig run groovy<\/pre>\n<\/div>\n<div>\n<pre class=\"brush: bash\">Mar 29, 2015 7:48:22 AM java.util.prefs.FileSystemPreferences$1 run<br \/>INFO: Created user preferences directory.<br \/>Groovy Shell (2.4.2, JVM: 1.8.0_40)<br \/>Type ':help' or ':h' for help.<br \/>-------------------------------------------------------------------------------<br \/>groovy:000&gt;<\/pre>\n<\/div>\n<div>\n  \n<\/div>\n<div>\n  Or clojure with lein:\n<\/div>\n<div>\n<pre class=\"brush: bash\">$ fig run clojure<\/pre>\n<\/div>\n<div>\n<pre class=\"brush: bash\">nREPL server started on port 52730 on host 127.0.0.1 - nrepl:\/\/127.0.0.1:52730<br \/>REPL-y 0.3.5, nREPL 0.2.6<br \/>Clojure 1.6.0<br \/>Java HotSpot(TM) 64-Bit Server VM 1.8.0_40-b25<br \/>&nbsp; &nbsp; Docs: (doc function-name-here)<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (find-doc \"part-of-name-here\")<br \/>&nbsp; Source: (source function-name-here)<br \/>&nbsp;Javadoc: (javadoc java-object-or-class-here)<br \/>&nbsp; &nbsp; Exit: Control+D or (exit) or (quit)<br \/>&nbsp;Results: Stored in vars *1, *2, *3, an exception in *e<br \/><br \/>user=&gt;<\/pre>\n<\/div>\n<div>\n  \n<\/div>\n<div>\n  Or python 3.4:\n<\/div>\n<div>\n<pre class=\"brush: bash\">$ fig run python34<\/pre>\n<\/div>\n<div>\n<pre class=\"brush: bash\">Python 3.4.2 (default, Oct &nbsp;8 2014, 13:08:17)&nbsp;<br \/>[GCC 4.9.1] on linux<br \/>Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.<br \/>&gt;&gt;&gt;<\/pre>\n<\/div>\n<div>\n  \n<\/div>\n<div>\n  Or ghci haskell:\n<\/div>\n<div>\n<pre class=\"brush: bash\">$fig run haskell<\/pre>\n<\/div>\n<div>\n<pre class=\"brush: bash\">GHCi, version 7.6.3: http:\/\/www.haskell.org\/ghc\/ &nbsp;:? for help<br \/>Loading package ghc-prim ... linking ... done.<br \/>Loading package integer-gmp ... linking ... done.<br \/>Loading package base ... linking ... done.<br \/>Prelude&gt;<\/pre>\n<\/div>\n<div>\n  \n<\/div>\n<div>\n<div>\n    You could also run command on docker container with use of files from your current directory because it is mapped to \/project directory on docker. Container starts with \/project directory as current directory.\n  <\/div>\n<div>\n    For example you have a simple file in your current dir:\n  <\/div>\n<div>\n<pre class=\"brush: bash\">$ cat simplePrint.scala&nbsp;<\/pre>\n<\/p><\/div>\n<div>\n<pre class=\"brush: bash\">println(\"Hello World\")<\/pre>\n<\/p><\/div>\n<div>\n    <br \/>You could run command with this file:<\/p><\/div>\n<div>\n<pre class=\"brush: bash\">$ fig -f PATH_TO_DOCKER_WITH_FIG_PROJECT\/fig.yml run scala scala simplePrint.scala<\/pre>\n<\/p><\/div>\n<div>\n<pre class=\"brush: bash\">Hello World<\/pre>\n<\/p><\/div>\n<div>\n    \n  <\/div>\n<div>\n    First &#8216;scala&#8217; in command means that you want to run scala container and &#8216;scala simplePrint.scala&#8217; means that you want to execute this command on container.\n  <\/div>\n<div>\n    \n  <\/div>\n<h1 id=\"conclusion\">\n    Conclusion<br \/>\n  <\/h1>\n<div>\n    It is simple, isn&#8217;t it? All you need is docker and fig and you could use repl or run command with scala, groovy, cojure and any other which are currently supported&#8230;\n  <\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"IntroductionSuppose you want to run scala repl or groovy shell or any other repl-like executable. You should download executable, unpack it, set PATH environmnt variable and now you could use it. Can it be simple? Yes, dockerize everything.Prepare cont&#8230;\n","protected":false},"author":54,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[549,537],"class_list":{"0":"post-12445","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-development-design","7":"tag-docker","8":"tag-shell"},"_links":{"self":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/12445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/users\/54"}],"replies":[{"embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/comments?post=12445"}],"version-history":[{"count":5,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/12445\/revisions"}],"predecessor-version":[{"id":14526,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/12445\/revisions\/14526"}],"wp:attachment":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/media?parent=12445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/categories?post=12445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/tags?post=12445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}