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.

  • Testing a Node library working with Docker containers
  • How to use command in docker-compose.yml
  • use cloudera with docker-compose
  • WebSharper ui.next site working locally but not in docker
  • In docker, how are storage driver and backing file system different?
  • Running multiple dependent apps each with their own docker compose file
  • How to get JSF working with spring-boot app in docker container?
  • How to replace a Docker data volume with another at runtime?
  • docker-compose: how to map few ip to few containers
  • Docker proper redirect link
  • Kafka with Docker dynamic advertised_host_name
  • Getting error installing nodejs when building from docker
  • 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.