Member-only story
Building Docker Images — Learning Docker
INTRODUCTION
Simply put, to deploy an Angular application, we can run the build command and then copy the /dist files into an Apache or Nginx host. But what if we deploy using Docker? Before we start, there are a few things we need to know briefly about Containerization.
- Docker: A Containerization Platform that makes it easy to develop, deploy, and run applications in an isolated environment called Containers.
- Docker Image: A blueprint used to build a Docker Container.
- Containers: Runnable instances of a docker image. Containers “wrap” one or several docker images and their isolated dependencies.
- Dockerfile: Used to create a docker image. The Dockerfile contains step-by-step instructions on how to run an application.
What are the advantages of using Docker? Using Docker allows us to bundle the application along with its libraries and dependencies in an isolated container. For example, if there are two different PHP versions in one Apache, it does not affect us because our application has been isolated.
As an example, here I will build a container for an Angular application.
CREATE DOCKERFILE
Create a new file named Dockerfile in the Angular project. In short, the following…