Skip to content

Instantly share code, notes, and snippets.

@groundwater
Last active December 23, 2015 12:18
Show Gist options
  • Save groundwater/6633988 to your computer and use it in GitHub Desktop.
Save groundwater/6633988 to your computer and use it in GitHub Desktop.
Example NodeOS Dockerfile

Building NodeOS

Custom NodeOS distributions can be build easily with a Dockerfile. Start from the nodeos/kernel image which consists of only the linux kernel, required system libraries, the nodeos executable, and a few NodeOS essential packages.

Generally you'll want to customize your build by adding additional RUN npkg install <PKG> lines.

Build your box with sudo docker build -t "mybuild" . from the same directory as your Dockerfile. Run the resulting box with sudo docker run -t -i mybuild. The default behaviour of NodeOS is to boot into a shell after starting the init daemon. You can customize boot behaviour by passing extra arguments to docker.

For example, start the default run-level with

sudo docker run -t -i mybuild npkg start nodeos-default
# build nodeos from a bare image with only the linux kernel,
# and node binary installed
FROM nodeos/kernel
MAINTAINER Jacob Groundwater <[email protected]>
# Environment variables passed to the init process and RUN commands
# setting BOOT=0 tells init to also exit after the shell process exists
ENV BOOT 0
# Incrementally customize the NodeOS box with pre-installed packages
RUN npkg install fizzybox
RUN npkg install ssh
RUN npkg install leveldb
# Run init as the first process
ENTRYPOINT /root/bin/init
# Tell init to immediately boot into a shell after starting
CMD nsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment