How to build an image
You have two options: (1) using the docker build commands (there is a registry of images on the web of docker) or (2) using a Dockerfile that looks like something like this:
FROM ubuntu:14:04 COPY, ADD, EXPOSE, RUN apt-get
You can interact with the host machine: port forwarding, shared folders, etc.
How to run the container
docker run <image> exec <command>