How to create a container and run images in docker

0 votes
Feb 22, 2019 in Docker by Kavilakshmi
• 410 points
2,223 views

1 answer to this question.

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 23, 2019 by Kalgi
• 52,350 points

selected Feb 26, 2019 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
• 10,620 points
3,521 views
0 votes
1 answer

Mount a volume and run a docker container in read-only mode

You can achieve this using the following $ ...READ MORE

answered Jul 3, 2019 in Docker by Sirajul
• 59,230 points
1,750 views
0 votes
1 answer

How to create a user-defined Bridge network in docker?

To create a user-defined bridge network, one ...READ MORE

answered Jul 3, 2019 in Docker by Sirajul
• 59,230 points
2,697 views
0 votes
1 answer

How to Backup, Restore or Migrate data volumes in a docker container?

Steps to Backup a container 1)     ...READ MORE

answered Jul 3, 2019 in Docker by Sirajul
• 59,230 points
14,156 views
+2 votes
1 answer
+2 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
• 58,020 points
2,718 views
+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,220 points

edited Oct 16, 2018 by lina 34,139 views
+15 votes
19 answers

How can I run a ‘docker exec’ command inside a docker container?

you can run any command in a ...READ MORE

answered Dec 10, 2018 in Docker by Pramiti
1,229,598 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP