Lightweight container builder for Linux backed by
npm install -g mkcontainer
First make sure you have
Then make a
Containerfile which has a format similar to a
FROM ubuntu:xenial RUN rm -f /etc/resolv.conf && echo '22.214.171.124' > /etc/resolv.conf RUN apt-get update RUN apt-get install -y git vim curl RUN curl -fs https://raw.githubusercontent.com/mafintosh/node-install/master/install | sh RUN node-install 8.9.1
Containerfile installs Ubuntu 16.04 (xenial), then updates the name server so dns works, and installs git, vim, curl and node 8.9.1.
To make a container from that
Containerfile simply cd into the same dir and run
This should produce a
Makefile, that is automatically run and a container called
container.img. The container is around 4GB but should be sparse (see
ls -lsh for the actual size)
If you run
mkcontainer again the build should be cached. Similar to docker, when you update a line in the
Containerfile you cache invalidate every line below it. There is a global cache for each layer stored in
To run the produced container do
sudo systemd-nspawn -a -i container.img /bin/bash
Containerfile currently understands the following primitives
FROM os:version- will bootstrap your container.
Debiancurrently. Note that `Arch doesn't have a version.
RUN cmd- run a shell command inside the container
COPY from to- copy a file into the container.
toshould be an absolute path.