Run a Docker image as a container

The specific way to run it depends on whether you gave the image a tag/name or not.

$ docker images
REPOSITORY          TAG                 ID                  CREATED             SIZE
ubuntu              12.04               8dbd9e392a96        4 months ago        131.5 MB (virtual 131.5 MB)

With a name (let's use Ubuntu):

$ docker run -i -t ubuntu:12.04 /bin/bash

Without a name, just using the ID:

$ docker run -i -t 8dbd9e392a96 /bin/bash

Please see Docker run reference for more information.


Do the following steps:

  1. $ docker images

    You will get a list of all local Docker images with the tags specified.

  2. $ docker run image_name:tag_name

    If you didn't specify tag_name it will automatically run an image with the 'latest' tag.

    Instead of image_name, you can also specify an image ID (no tag_name).