Dockerizing a Programming Language
--
A compiler is just a software application after all.
I have a confession: for the last eight years I have been avoiding using Docker. It’s not that I don’t understand the value of containers, it’s that the first time I picked up Docker I had a really bad experience. So bad it convinced me that this technology was too difficult for me to master. I would find out later that because of the nature of what I was being asked to do with Docker at the time (and because I was and still am primarily a Mac user) I had managed to ran into most of the really nasty edge cases that plagued the early years of Docker. But by the time I realized that, I had shifted over to legacy technology full time where most of our problems were trying to roll out version control or basic testing … forget about Docker.
A bit later I switched over to management and it looked like I would never have to face my fears around Docker! Huzzah!
Then came Fault.
Fault is my programming language project. As its design evolved it became obvious that executing Fault specifications was going to require a SMT Solver. That introduced the question of how to correctly manage the non-Go related dependencies of a Go code base. I tried out a variety of different approaches with various levels of success, knowing that Docker was looming in the distance.
To make a long story short: this time around I found it pretty easy to figure out how to get Docker to do what I want. That was a huge relief! Go binaries built, solver up and running. I was ready to go.
The only problem is that, as a programming language, Fault is supposed to run on the command line. Docker still assumes that at the end of the day you’re building a web service that will speak to others over open ports. Command line applications don’t communicate that way. I wanted to maintain the look and feel of a CLI, while still getting the benefits of containerization.
It’s been a long time since I wrote a true technical tutorial. Unlike others I’ve done, all this information is out there and easy to find. But I really like how simple it was to make a Docker based application look and feel like a tradition CLI running directly on the host machine. I hope a thorough breakdown might help and inspire others.