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?

Thanks.
Sep 7, 2018 in Docker by shubham
• 6,480 points

retagged Sep 7, 2018 by shubham 30 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,250 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
• 35,750 points
36 views
0 votes
1 answer

How to run a docker command from inside the container?

You must have come across the /var/run/docker.sock file, ...READ MORE

answered Jun 28, 2018 in Docker by Sophie may
• 9,050 points
211 views
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,250 points
659 views
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,250 points
189 views

© 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.