How do I run a docker image as a container?

0 votes
I am new to Docker. I have built a docker image from a dockerfile.The image was built successfully, but what do I do with it? Shouldn't it be able to run as a container?   Probably I am missing some very basic thing.

Can anyone help me with this?

Sep 7, 2018 in Docker by shubham
• 6,610 points

retagged Sep 7, 2018 by shubham 38 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You can run an image 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 for e.g. -  in this case Ubuntu :

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

or you can run it by just using the ID:

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

I hope it would be helpful for you.

answered Sep 7, 2018 by Damon Salvatore
• 5,470 points

Related Questions In Docker

0 votes
1 answer
+2 votes
11 answers
0 votes
1 answer

How do I get into a Docker container?

docker attach will let you connect to your ...READ MORE

answered Aug 10, 2018 in Docker by Kalgi
• 36,690 points
0 votes
1 answer

What is a docker file? How do I create a docker image with dockerfile?

 A Dockerfile is a script/text configuration file that contains ...READ MORE

answered Jun 7 in Docker by Sirajul
• 940 points
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How do I copy a file from docker container to host?

Here is a way which you can ...READ MORE

answered Aug 27, 2018 in Docker by Damon Salvatore
• 5,470 points
0 votes
1 answer

How do I force Docker for a clean build of an image ?

You can try the following step: You have ...READ MORE

answered Sep 7, 2018 in Docker by Damon Salvatore
• 5,470 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.