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.

  • What is the docker registry v2 API endpoint to get the digest for an image?
  • artifactory oss docker 5.0.0 upgraded to 5.1.0 now it won't start
  • Docker environment variable security
  • Docker process suspends and gets killed
  • how to retrieve volume from a removed Docker container?
  • Updating Task Definitions in ECS
  • Using SSH keys inside docker container
  • Using Openblas with R in Reproducible R container
  • How to update a Kubernetes deployment on Google Container Engine?
  • renaming docker0 virtual bridge name to something else
  • How do I install things on Kitematic Boot2docker linux?
  • How can I connect my container group (scalable container) to my mongodb container (single node) on Bluemix?
  • 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 https://docs.docker.com/engine/reference/run/ 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.