How I Reduced Docker Image Size from 1.43 GB to 22.4 MB
In 5 Simple Steps

If you are working in web development, then you probably already know about the idea of containerization and how it’s so great and everything.
But when working with Docker image size is a great concern. It’s often over 1.43 GB for just the boilerplate project that we get from create-react-app
Today we will containerize a ReactJS application and learn some tricks about how we can reduce the image size and, at the same time, improve performance.
The tricks will be shown for ReactJS, but it applies to any NodeJS application.
Step 1. Create Your Project
- Simply go to your terminal and type
npx create-react-app docker-image-test- Then create-react-app will provide you with your basic React application
- Afterward, go into the root directory and run the project.
cd docker-image-test
yarn install
yarn start- Then go to http://localhost:3000 to see that your application is up and running.

Step 2. Build Your First Image
- Inside the root directory of your project, create a file named Dockerfile and paste the following code there.











