Tuesday, February 6, 2018

Docker for Script Kiddies


Do you want to easily write some code and run it and not foul up your normal desktop with funky environment variables or versions of scripting languages that aren't officially supported? Yes.

Do you want to use Docker because it is the cool thing that all the other kids are running now? Yes.

Alpine Linux is built to be super super small so it is perfect for things like Docker where you might have a lot of your systems running in parallel. So I build my examples on top of Alpine Linux because why not. I picked the "most popular" programming languages that can be easily installed in vanilla Alpine Linux. This means that Go,  Java, and C# are left out because Alpine Linux uses musl instead of gnu libc and that's not something easily supported out of the box (much respect for Rust for supporting this).

So here are all my GitHub repos with some basic shell scripts for you to run so you can see a HelloWorld run in the languages that are easily supported in vanilla Alpine Linux

GitHub Repos

File Size Comparison

Of all the ways to measure a programming language probably the worst way is to compare the file size needed on disk to get a Hello World program running. But it was easy to do so I went ahead and did it. The base Alpine Linux weighs in at 4.15MB so everything else is on top of that.
  • COMPILER: GCC 6.4.0
    • SIZE: 100MB
  • COMPILER: G++ 6.4.0
    • SIZE: 152MB
  • LANGUAGE: Node.js v8.9.3
    • SIZE: 50.2MB
  • LANGUAGE: PHP 7.1.12
    • SIZE: 14.2MB
  • LANGUAGE: Python 2.7.14
    • SIZE: 44.3MB
  • LANGUAGE: Python 3.6.3
    • SIZE: 55.4MB
  • LANGUAGE: Ruby 2.4.3
    • SIZE: 20.4MB
  • LANGUAGE: Rust 1.22.1
    • SIZE: 267MB