How to create a container and run images in docker?

0 votes
Feb 22 in Docker by Kavilakshmi
• 400 points
100 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 22 by Kalgi
• 41,760 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,850 points
368 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 in Docker by Sirajul
• 31,060 points
173 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 in Docker by Sirajul
• 31,060 points
107 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 in Docker by Sirajul
• 31,060 points
151 views
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,900 points
189 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,110 points

edited Oct 16, 2018 by lina 4,839 views
+1 vote
11 answers