Understanding Docker
Tags: docker, beginners, react, devops
Published: 2023-04-12 08:23:01

In good olden days, Applications were managed to build and run in huge on-premises data centers allocated in separate rooms. Later trend shifted to Virtual machines. Now it is time for Docker. Maybe something in future but until then, it’s Docker….


![Docker basics](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hekom7cd50df29koq04m.png)

## History

Container technology started in the year 2000. Many companies were involved in the evolution of Docker such as FreeBSD, Linux, Solaris, Google, Redhat, IBM.


![Docker History](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v43he7r940o9n9icl58b.png)

There is company called Docker, Inc. and technology called Docker. They are closely linked but they are not same. Docker, the company, technology start up from San francisco and main sponsor for the container technology Docker.

Originally, it was company called dotCloud that provided a developer platform on top of AWS(Amazon Web Services). Around 2013, they designed a container to build, run and deploy the application on top of AWS and thought to give this tech to the world and build applications around it, that tech was nothing but Docker. Now Docker has literally changed the technology world.

Docker , the technology is a software platform to build, run and deploy the applications. On the other hand, Docker, Inc. the company is now focused on orchestrating and supporting the containerised apps at scale on enterprise content management System.

## Docker

Docker is a Software platform to build, run and deploy applications. It is an open source and lives in Github. It has Community edition which is free to use and has many of the supporters Whereas enterprise edition is managed by Docker, Inc. provides support on enterprise content management system.

To run applications in Docker, below is the workflow we follow to run inside the container.

- Take application code
- Build it into a Docker image
- Push image to registry
- Start a container


![Docker steps](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zr5oy4vajgrurszdjjkt.png)

Lets elaborate each above step which gives us more clear view.

Take you application code say Web, API or any other application. we can run anything in containers even if it is a monolithic application(it consumes more OS and supporting packages). But there are best principles we need to follow to run applications with minimal OS and minimal supporting packages. Saying it again Containers are not meant for Microservices and can run any applications.

**Note:** Need Docker installed in your system to perform below operations.

Create a file named with Dockerfile and write commands to build code into Docker images. Below is the sample snippet


![Code Snippet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5gqued24r1wm37o1pr3x.png)

Run the following command to turn your code into images

```
docker image build -t reactweb
```

Once after successful running, it pushes image to a registry. Now we start running image into container as below

```
docker run -p 3000:80 -d reactweb
```

Above command runs docker under host port with 3000. If you open browser and navigate to http://localhost:3000, it runs web applications.

For reference, complete source code is in [React-Docker](https://github.com/sandeep0515/Microfrontends) repository

Isn’t it easy? yes it is. But still there is a lot to learn in Docker.

Deep dive into Docker Architecture, Step by step for Installation and Docketerise the app and many more to come in upcoming blogs. Hope you like the content

Stay tuned. See you in next article.