Build and Run a Docker Container

This page shows how to build and run a container in Docker in one go. These commands can be executed either directly on the Docker terminal, or in PowerShell, or on a Windows command prompt. The first line instructs Docker to create an image, tags it with a user friendly name, and the dot tells the Docker in which folder to find the Dockerfile. Dockerfile contains the instructions on how to create the image based on which the new container will be built. The dot points to the current folder. 3000:3000 maps the physical port 3000 of the computer to the port 3000 of the newly created Docker container.

bash
docker build -t imagename .
docker run --name containername -p 3000:3000 imagename