Testing Nim Code Using Github Actions
Github has really improved lately with the addition of Github Actions. I’ll just refer to them as GA from here on. It’s very easy to add continuous integration tests and builds of your code if you’re using one of their supported languages like Node.js, Python or Ruby. But what if you want to test your Nim project? What are your options?
Compile nim from scratch GA’s are declared in YAML and let you run arbitrary commands.
Docker Now Supports Adding Host Mappings
In my previous blog entry, I mentioned that Docker didn’t provide any way to add host-to-ip mappings to /etc/hosts. Well, the most recent version of Docker (1.3.1) now addresses that issue with a new add hosts option. Let’s take a quick look at what it does.
Given a standard default /etc/hosts.
% docker run -it ubuntu cat /etc/hosts 172.17.0.8 b14031841b2b 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters We can add a mapping for server ‘foo’ at ‘10.
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.