Skip to content

Instantly share code, notes, and snippets.

@mvtango
Forked from dceejay/Dockerfile
Last active August 29, 2015 14:23
Show Gist options
  • Save mvtango/0e87186b39a08f2e1a20 to your computer and use it in GitHub Desktop.
Save mvtango/0e87186b39a08f2e1a20 to your computer and use it in GitHub Desktop.
node-red Docker
# Dockerfile for Node-RED - pulls latest master code from git
# Use the node.js v0.10.36 engine
# based on the Dockerfile from ceejay
FROM node:0.10-slim
MAINTAINER mvtango
# download latest stable node-red
RUN npm install -g mongodb \
node-red \
node-red-admin \
node-red-contrib-googlechart \
node-red-contrib-geonames \
node-red-contrib-yr \
node-red-node-aws \
node-red-node-dropbox \
node-red-node-feedparser \
node-red-node-forecastio \
node-red-node-google \
node-red-node-mongodb \
node-red-node-pushbullet \
node-red-node-sqlite \
node-red-node-twitter
# use external storage for the user directory
VOLUME /root/.node-red
# expose port
EXPOSE 1880
# Set the default command to execute
# when creating a new container
CMD /usr/local/bin/node-red

Collection of useful node-red nodes

Install docker as per latest instructions at

https://docs.docker.com/installation/

e.g. for Ubuntu 14.04

sudo apt-get update
sudo apt-get install linux-image-generic-lts-trusty wget
wget -qO- https://get.docker.com/ | sh

add yourself to docker group for when you get fed up with all the sudo below...

sudo usermod -aG docker $USER
sudo service docker restart

install Node-RED from the gist above

sudo docker build -rm -t davecj/node-red http://gist.github.com/raw/9435867/Dockerfile
or
sudo docker build -rm -t davecj/node-red git://gist.github.com/9435867.git

(or copy / paste the Dockerfile and build)

sudo docker build -rm -t davecj/node-red - < Dockerfile

Note: there will be errors during the npm install - but they should be warnings about gyp failing to build icu and serialport - but they will fail back to pr-compiled versions ok. So all should be ok.

run (as daemon)

sudo docker run -d -p 1880:1880 --name mynodered davecj/node-red

start a command line inside the container

sudo docker run -it --rm -p 1880:1880 --name mynodered davecj/node-red /bin/bash

show running containers

sudo docker ps -a

show all images (so you can tidy up)

sudo docker images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment