How to create a container and run images in docker?

0 votes
Feb 22 in Docker by Kavilakshmi
• 400 points

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
Best answer

Look for what all images you have on your system using the following command:

docker images

Execute this command to build an image and when you build the image, a container automatically gets created.

docker build -t image-name .

You can run this image using this command:

docker run -p 80:80 -it image-name

Where -p stands for port mapping which maps the container's internal port to system's port which exposes whatever running on the container.

answered Feb 22 by Kalgi
• 36,420 points

selected Feb 26 by Kavilakshmi

Greetings from edureka! Community.

We have reviewed your post and have concluded there is no reason for your post to be flagged. Hence, we have cleared the flag.

Continue to Ask, Learn & Collaborate!

Related Questions In Docker

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,330 points
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,140 points
+4 votes
4 answers

How To Access a Service on Host From a Docker Container?

Adding to kalgi's answer, You can also ...READ MORE

answered Oct 16, 2018 in Docker by lina
• 8,100 points

edited Oct 16, 2018 by lina 2,565 views
+2 votes
11 answers

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