Docker: a Container Management Tool

https://unsplash.com/photos/_SgRNwAVNKw

Are you a developer? And are you worried about the system that will be running on? Take a deep breath and calm down, use the ✨Docker✨

What is Docker?

What is Container?

How to use Docker?

  1. Docker Image
    the file that contains guides and information for building a container.
  2. Container
    environment or environment for application packaging needs that include system tools, code, runtime, and configuration.
  3. Docker Client
    a place where users can send commands such as the Docker run, pull, and build to the Docker Daemon.
  4. Docker Host
    responsible for receiving commands from the Docker Client
  5. Docker Engine Rest API
    used for interaction with the Docker Daemon
  6. Docker Hub
    a service that allows sharing Container Image with the team.
  7. Docker Daemon
    responsible for managing Docker Image, Container, Storage Volume and Network.
  8. Docker Registry
    a place to store the Docker image which will give the output according to the given command.
Docker architecture — https://docs.docker.com/get-started/overview/

Docker uses a client-server architecture. The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers. Docker clients and daemons communicate using the REST API, via a UNIX socket or network interface. The Docker client and daemon can run on the same system, or you can connect the Docker client to a remote Docker daemon. Another Docker client is Docker Compose, which lets you work with applications that are composed of a collection of containers.
The Docker daemon will execute commands by managing objects such as images, containers, etc.

Docker Implementation

Dockerfile

The command beside basically tells docker to :

  • FROM — Create an image from a Python 3.8 image
  • WORKDIR — Change the working directory to $DockerHOME
  • ENV — Set the environment variables
  • RUN — Install dependencies
  • COPY — Copy the whole project to docker home directory
  • EXPOSE — Port where the Django app runs
Dockerfile.web

Next up is Dockerfile.web which sets up the environment and ensures that the Heroku container will do the python commands (makemigrations, migrate, and then runserver).

Update your GitLab configuration to include the docker image. Below is an example of our GitLab configuration for a docker image.

There are common functions that Docker has:

1. Supporting Developer Productivity

2. Simple Configuration Stage

3. Enable Portability

Conclusion

References:

Computer Science Student at University of Indonesia