Blog

Dockerizing apps

Wed Sep 25 2019

Infra
Docker
Ship

You expect all of your local environments to act the same.

Configuring an infrastructure can be though - especially if you are working with many developers. This is when docker comes in. Docker speeds up your configuration process and keeps all your project dependencies wrapped up.

Cloud migration

Many companies decide to move their product to a cloud provider and move towards containerized deployments. Back in the traditional deployment era, there were no real solutions to define resource boundaries. If multiple applications run on the same server one of the apps could take up all the hardware resources and others could underperform. Docker is the tool to create containerized applications.

Building a Dockerfile and docker-compose.yml

We are using Dockerfile at the root of our project to create an image.

FROM  <image>
COPY  <files_from_folder_to_image>
RUN   <shell_command_during_build>
CMD   <or_during_runtime>

And docker-compose.yml to define the services, networks and volumes

version: <version_of_translator>
  services:
    <my_service_name1>:
      image: <docker_image>
    <my_service_name2>:
      build: .
      volumes:
        - <assigned_volume>
      ports:
        - <assigned_port>
      depends_on:
        - <my_service_name1>