Search code examples
node.jsdockerdockerfileiojs

How to run Iojs in Docker?


I have the following Dockerfile:

FROM ubuntu:14.10

ENV HOMEDIR /usr/share/iojs

RUN apt-get update && \
    apt-get install software-properties-common python-software-properties -qq -y && \
    apt-get upgrade -y && \
    apt-get install -qq -y supervisor npm

RUN cd ${HOMEDIR} && \
    wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.26.1/install.sh | bash && \
    . ~/.nvm/nvm.sh && \
    nvm install iojs

RUN supervisorctl restart iojs

EXPOSE 80

CMD ["/usr/bin/supervisord", "-n"]

And /etc/supervisor/conf.d/supervisord.conf

[supervisord]
autostart=true
autorestart=true
nodaemon=true

[program:iojs]
directory=/usr/share/iojs
command=/usr/bin/iojs index.js
autostart=true
autorestart=true

Note: scripts are in /usr/share/iojs


Solution

  • This is a different approach, not saying that yours doesn't work. Why not start from the iojs image based off of Debian 8 in dockerhub.

    Dockerfile:

    FROM iojs
    # ...
    

    supervisord conf:

    [supervisord]
    autostart=true
    autorestart=true
    nodaemon=true
    
    [program:iojs]
    directory=/usr/share/iojs
    command=/usr/local/bin/iojs index.js
    autostart=true
    autorestart=true