Run a Docker Image as a Container

I built a docker image from a dockerfile. I see the image was built successfully, but what do I do with it? Shouldn’t it be able to run as a container?

New to docker so probably a misunderstanding on my end, any help would be great.

  • Can Jprofile connect to JVM running in docker
  • Pull all images with specific tag from repository
  • Pass --net=host to docker build
  • passing multiline string via .env file docker
  • docker, --storage-opts and aufs storage-driver
  • getting Docker script to load with git-bash in ConEmu/Cmder
  • How to sync the time of a java application running on docker container?
  • How to pass argument to Docker file ( specifically to FROM instruction)
  • Getting docker-machine to create host without tlsverify
  • Behat, MySql Connection error in Laravel5 : 'PDOException''SQLSTATE[HY000] [2005] Unknown MySQL server host 'mysql' (2)'
  • Passing multiple env files in docker run command
  • Docker CentOS 7 Fail push to private insecure registry v1.12.0
  • 3 Solutions collect form web for “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
    root@dockertest:~# 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 for more information.

    Do following steps :

    1. $ docker images

      you will get list of all local docker images with tags specified.

    2. $ docker run image_name:tag_name

      If you didn’t specify tag_name it will automatically run image with ‘latest’ tag.

      Instead of image_name you can also specify Image Id (no tag_name).

    Here is an example to run a webdev service in docker.
    The image’s name is morrisjobke/webdav. You can pull it from dockerhub.

    After you run this images,you can then access the WebDAV instance at http://localhost:8888/webdav. Internally the folder /var/webdav is used as WebDAV root.

    You can run this container in following way:

    $ docker run -d -e USERNAME=test -e PASSWORD=test -p 8888:80 morrisjobke/webdav

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.