Running docker services locally
Image source: github

Introduction

Often times I’m away from the internet. Be that due to being at a camp site, in a car traveling, visiting family or friends, etc.

There are also cases around privacy of services that one may want to use, that is best done in a local environment. This can include some of the AI models.

Docker [1] is an amazing product, and something available on many platforms. Through Docker, you can host images for these services, accessible to just yourself, running on your local hardware. There’s a limitation in terms of memory/ram, but if you have ample amounts of it, it’s worth using.

In this post, I want to talk about two such cases in this, and why I set them up.

Running a Local Pip Cache

pip [2] is a tool used for installing packages used in Python development. Often, I tear down, and rebuild/setup environments when working on active development. When I’m at home, this is usually not a problem, but if I’m around a place with less internet, then downloading packages becomes a challenge. In those cases, I either have to skip doing any work in Python, or start copying or using other environments. Either way, given the RAM I have on this machine, I wanted to setup my own pip server.

I came across an interesting project [3] that did what I was aiming for, but is an older project. The calls to devpi [4] changed since it was written. I took this opportunity to upgrade the package to work with the newer devpi calls.

You can find this repository, as well as instructions and use, at https://github.com/TheDarkTrumpet/docker-pip-cache

Running LanguageTool

There’s an interesting service online called LanguageTool [5] that can be used to check spelling and grammar. I use it with Obsidian for my note taking system. That said, I’m not entirely fond of sending all my information to another server to be processed like this. I found a good docker repository [6] that can run an open-source version of LanguageTool in a container. LanguageTool, from the container image site [6] says the following:

LanguageTool is an Open Source proofreading software for English, French, German, Polish, Russian, and more than 20 other languages. It finds many errors that a simple spell checker cannot detect.

I’m not fond of running docker run by itself as in how the repository recommends, and instead prefer using Docker Compose [7]. Below is the code which I’m using, which is from a miscellaneous docker git-backed repository for common things I run.

version: '3.2'

services:
  languagetool:
    image: erikvl87/languagetool
    container_name: language_tool
    restart: unless-stopped
    ports:
      - "127.0.0.1:8010:8010/tcp"
    deploy:
      resources:
        limits:
          cpus: "1"
          memory: 1024M

References

  1. Docker
  2. Pip
  3. Aanotoly’s docker-pip-cache
  4. devpi
  5. languagetool.org
  6. erikvl87/languagetool
  7. Docker Compose

David Thole

David Thole
Senior Software Architect, Developer, Instructor. Reads/studies a lot and enjoys all things technology

Current AI Stack and Overview

# IntroductionIt's been awhile since I last wrote, and figured now is as good of time as any to write about my recent set of tools and me...… Continue reading

Local Artificial Intelligence Tools

Published on January 19, 2024

Effective prompting with AI

Published on January 09, 2024