Skip to content
Fix Code Error

Run a Docker image as a container

March 13, 2021 by Code Error
Posted By: Anonymous

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

Solution

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.

Answered By: Anonymous

Related Articles

  • Ubuntu apt-get unable to fetch packages
  • How do you list volumes in docker containers?
  • Reference - What does this regex mean?
  • How to remove old and unused Docker images
  • How to mount host volumes into docker containers in…
  • Runing vue/cli app under docker simple index.html is opened
  • How to use local docker images with Minikube?
  • Docker remove TAG images
  • From inside of a Docker container, how do I connect to the…
  • Why are ARGS specified in `docker-compose.yml` available in…

Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.

Post navigation

Previous Post:

What does “static” mean in C?

Next Post:

Is there a built-in function to print all the current properties and values of an object?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Get code errors & solutions at akashmittal.com
© 2022 Fix Code Error