Modifying /etc/hosts in Docker Images for Fun and Profit
Update: Read my newer post that talks about Docker’s add-host option.
Did you know that Docker doesn’t let you (easily) modify /etc/hosts? You can’t programmatically add aliases for localhost or new hostname-to-ip mappings. In short, Docker treats /etc/hosts like a static resource.
No problem. This will just take a quick Unix script to solve.
Attempt 1, the slate is wiped clean No big deal, right? We simply write ourselves a little sed script to alias localhost and add a couple additional hostname mappings.
Unable to Remove Docker Image
I’ve been playing around with building Docker images and noticed I had a few that had <none> as both the repository and tag info.
% docker images REPOSITORY TAG IMAGE ID … <none> <none> c1e0e48a03bb <none> <none> c8bf15029bc0 I tried to delete these untagged images, but couldn’t.
% docker rmi c1e0e48a03bb Error response from daemon: Conflict, cannot delete c1e0e48a03bb because the container 5f266c452a8b is using it, use -f to force Ok, so we’ll try to force deletion.
Emacs Erlang Snippets
Continuing with my previous yasnippet for Ruby, here are some snippets for Erlang mode.
Installation Create an erlang-mode directory under text-mode and save the following code in a file name mod.
#name : -module(). #contributor : hitesh <hitesh.jasani gmail.com> # – -module(${1:$(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))}). $0 Save the following code in a file named exp.
#name : -export([]). #contributor : hitesh <hitesh.jasani gmail.com> # – -export([${1:start/0}]). $0 Save the following code in a file named imp.
Textmate Ruby Snippet to yasnippet
Dr. Nic recently put together a screencast of adding a Ruby snippet to TextMate. This particular snippet makes a class definition using the filename as the default classname. I always enjoy listening to Dr. Nic, so definitely check out the ‘cast.
I used to love TextMate, but I can’t use it anymore since I’m working on multiple platforms. Emacs is my editor of choice now and I can’t say that I’m missing anything.
Initial Release of hsparklines 0.1.0
Update: Source code is available on github.
I’ve put the first release of hsparklines up on Hackage. It’s a sparklines library implemented in Haskell. I know there are a number of web service based solutions that one could use for this, but for those who’ve used web services, you know that there are some things you want to keep local.
If you haven’t played with sparklines yet, you should. They’re minigraphs inspired by Edward Tufte to present a large amount of contextual information in a minimum of space.