loading...

Docker for all #1: Introduction

fransafu profile image Francisco Javier Sánchez Fuentes Updated on ・2 min read

Hi Everyone!

I wrote an introduction about how does use with docker (is very simple), I hope you like :)!!

What is Docker?

"Docker is an open platform for developing, shipping, and running applications" -- Docker docs

Is technology for encapsulating application. All applications when running with docker have the own environment and isolate another app running over the same operating system.

How's use docker?

You can develop an application, they create Dockerfile with all dependencies and step for the run, then you should test docker in localhost and validate for deploy.

List of validations before deploy:

  • The behavior of the app is correct?
  • Request and Response it's fine (maybe unit testing)?
  • The image is secure for production (validate with the author or check with your own skills)?
  • Just have only necessary dependencies (production mode)?

When all validations pass, you must push all code to Git repository and run the Pipeline for deploy.

How to deploy Docker?

Actually have many options for deploy Docker, but principally, we can split this into two categories:

  • Pipeline CI/CD
  • Docker Cluster

If you want to make the build, test and deploy with your own hands... but I don't recommend this method (Shell Scripting)

Pipeline

It is a toolchain of jobs for build, test, upload to docker registry and deploy to cluster.

The main options are:

I prefer the Gitlab.

Docker Cluster

The cluster is a manager of Docker applications and its responsible for stay running, deploy all services, and more.

Actually existing many clusters for manage applications with Docker, the more famous is Kubernetes, also for the Internet of. Things (IoT) exists k3s (is the best option for IoT) and finally Swarm.

Kubernetes have many implementations on the cloud GKE, AKS, EKS

The main docker cluster for developing (non-production) is Minikube

With that, you know de main concepts and stages for work with docker.

Remember:

  • Develop
  • Make Dockerfile
  • Validate
  • Push to Git (never forget)
  • Run Pipeline
  • Deploy to docker cluster

Perfect :)! your app is running in high availability, with the best practices for deploy. Don't forget to do implement the 'Rollback' stage useful when implementation fails (but surely it doesn't happen to you, however, implement the stage).

Thanks for your time and I waiting for your feedback :)!

Discussion

pic
Editor guide