How to create a container and run images in docker

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

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,370 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,570 points
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,110 points
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,110 points
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,110 points
+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,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,220 points

edited Oct 16, 2018 by lina 24,897 views
+8 votes
19 answers