Building an image from a Dockerfile

To get started we create a file directory with a new Dockerfile within it e.g.

mkdir sinatra
cd sinatra
touch Dockerfile

Here's the contents of the docker file:

# This is a comment
FROM ubuntu:14.04
MAINTAINER James Robertson 
RUN apt-get update  apt-get install -y ruby ruby-dev
RUN gem install sinatra

To create a new image use the docker build -t [user/projectname:version] command e.g. docker build -t jrobertson/sinatra:v2.01 .

Note: The version value is optional.

See also