Pages

Friday, January 24, 2014

node.js on Fedora, Using Docker

Thanks to the node.js Fedora Dockerfile contribution from Jay Clark. In just a few simple steps, you can have an instance of node.js up and running in a Docker container. Here's how you run it. This was tested on Docker 0.7.2

Grab the dockerfile from either of these locations:

https://github.com/scollier/Fedora-Dockerfiles

or:

https://git.fedorahosted.org/cgit/dockerfiles.git/

Get the version of Docker

# docker version

To build:



Copy the sources down and do the build-

# docker build -rm -t scollier/nodejs .

To run (if port 8080 is open on your host):

# docker run -d -p 8080:8080 scollier/nodejs

or to assign a random port that maps to port 80 on the container:

# docker run -d -p 8080 scollier/nodejs

To the port that the container is listening on:

# docker ps

To test:

# curl http://localhost:8080
Hello World

Here's what it looks like, enjoy the asciicast:

No comments:

Post a Comment