Container Launching Butler!
• Mark Eschbach
I have a simple problem which I think Docker Compose can solve! For my UAT I need to boot a new version of a system to verify it works as expected. Before I was doing really crazy things with process and well known names. Now in theory it should be really easy! Let’s find out
I still have boot2docker installed, which has been awesome so far. I’m actually sad to see they are getting ride of that system. Easy install of the new system though.
Building out the Dockerfile
The UAT system requires a new Dockerfile. I’ve recently discovered the
Alpine images! Freaking great! Low Size! Buy them while supplies last! ruby:2.3.1-alpine weights in at a total of 39 MBs. That is like 42 floppies, right? I tend to create the directory
/app and give it the user
nobody. I would really like to randomize the user; perhaps in the future that will be an awesome goal. I generally add
Gemfile.lock seperately, but I wonder if I could add them at the same time. According to theory they should always change together. While searching if it’s possible, I came accross .dockerignore. Sounds like something I should remember for webapps. Looks like Docker might use Angular for the documentation.
Add does support multiple files! That will make life easier. A simple
docker build -t example:tag . should build the beast.
Until that beast explodes. I’ve got the following from the alpine image:
/usr/local/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first.
I’m on the fence about the correct approach. Should I install the dev tools in the alpine image? It would require a lot of reseraching. I’ll just eat the extra size. Hmm, it bailed out with the
chown -R nobody:nobody /app this time. Gah! Or I could just use a modified alpine image! Let’s try it out.
RUN apk --update add --virtual build-dependencies build-base ruby-dev openssl-dev seems to be the magic sauce. Installs 23 packages; never heard of
apk as unix install tool. I wonder if it’s trust worthy. THe fully loaded image weighs in at just over 316MBs. Extracting an image derriving from the same base with just the run statement creates an image of 293MBs. Not too bad I guess. Perhaps I can uninstall afterwards?
Well, if I thought that through I would have realized the last layer would contain fewer objects. Also if I read through the article. The installation of the build software, bundle, and uninstall of the build all need to occur in the same run command to work properly. Yup! About half the size anyway. Onto other things. Be back later!