Container Deployment

Introduction

This documentation is aimed at providing a step-by-step guide for developers on how to deploy the Vody Color Classification service using Docker. Docker allows the creation of a highly distributable and portable system that allows developers to package their application along with its environment, making it easy to deploy across various platforms and environments.

Our Color Classification service is a high-performance AI model designed to categorize objects based on their color. This service is containerized using Docker for ease of deployment, scaling, and versioning. This encapsulation is part of modern design approaches where services are bundled into their own environments, promoting separation of concerns and improving the overall software lifecycle.

Deployment Steps

  1. Pull the Docker Image: The first step is to fetch the latest Docker image of the Color Classification service from our Docker registry. You can do this by running the following command in your terminal:

    docker pull registry.vody.ai/color-classification:latest
    

    This command downloads the latest tagged image of the color-classification service from the registry.vody.com Docker registry.

  2. Run the Docker Image: After pulling the Docker image, the next step is to run the image. We will be running this image in a Docker container. Execute the following command in your terminal to run the service:

    docker run --gpus=all -d --rm -p 8080:8080 --name "vody-color-classification" registry.vody.ai/color-classification:latest
    

    This command breaks down as follows:

    • --gpus=all: This argument enables the container to use all available GPUs. This is important for machine learning tasks which typically require heavy GPU computation.

    • -d: This argument runs the container in detached mode, meaning the container runs in the background of your terminal.

    • --rm: This argument removes the container and its filesystem after the container exits. It's a good practice to keep the workspace clean.

    • -p 8080:8080: This argument maps the host's port 8080 to the container's port 8080. This allows the service inside the container to be accessible at port 8080 on your host machine.

    • --name "vody-color-classification": This names the container as "vody-color-classification". You can choose any name for the container.

    • registry.vody.ai/color-classification:latest: This is the name of the image we are running.

Once the container is up and running, the Color Classification service is accessible from your host machine at http://localhost:8080.

For specification and routes used in this service please refer to the Color Classification API Reference

Advantages of Deployment using Docker

Deploying services using Docker provides numerous benefits:

  1. Portability: Since Docker containers package the application along with its environment, you can be assured that the application will run on any other machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code.

  2. Isolation: Docker ensures your applications and resources are isolated and segregated. This eliminates any issues regarding dependencies and conflicting interactions with other software.

  3. Scalability and Consistency: Docker allows for easy replication of your application which is very useful when you need to scale out. Plus, you can rest assured that wherever you deploy your Docker containers, the behavior will be consistent.

  4. Efficient Use of System Resources: Unlike virtual machines, Docker containers do not reserve system resources. They use resources only when they need them, resulting in efficient utilization.

Conclusion

This modern approach to deploying services using Docker brings developers the ability to work in controlled, resource-isolated, and highly portable environments, which is paramount in a microservices architecture. This also brings about efficient use of system resources, easy scalability, and consistent behavior across various platforms. The adoption of these practices allows developers to focus on their core development work without worrying about system compatibilities and dependencies.