5 Ways To Run Docker Jobs Cheaply
The cheapest way to run docker jobs would be on the hardware that you already own. The main issue that comes in accomplishing this is the lack of proper tooling. Daestro is such a tool that solves this problem. It’s a container orchestrator which can be connected to your machine and run jobs remotely.
Why Docker
Docker provides uniformity for running your code, it packages your code into a container image which can be run anywhere. This enables you to run jobs anywhere, from cheaper VPS to bare metal servers from multiple providers.
However running one time docker job VS running it on repeat based on external signals is different game altogether.
#1 Your Machine
The cheapest option is the one you already own, that could be your laptop / PC or in-house server rack, given that the power of your machine matches the requirement of the job. The only thing you would need would be an orchestrator / control-plane which can connect to your machine and run jobs remotely.
This can be accomplished with Daestro, to do that you must connect your machine to Daestro by running Daestro’s agent. Once it’s online, the jobs can be allocated to it from Daestro. You can either create cron job or schedule one time run for later or trigger manually to run the jobs.
You can read this blog post on how to run jobs on your self-hosted compute.
#2 Free CI/CD Minutes
Many code hosting platforms such as GitHub and GitLab provide free CI/CD minutes on shared compute. You can use these platforms to run short lived, less compute intensive jobs for free.
GitHub provides 2,000 minutes of free CI/CD usage for private repositories, whereas for public repositories it is completely free for standard GitHub-hosted runners.
GitLab on the other hand provides 400 minutes of compute usage of shared runners on the free tier plan.
#3 Always Free VMs
If you would like to have access to full VM where you can log in, install Docker and let jobs run perpetually the below are some cloud providers who offer permanent free-tier VMs.
- Oracle Cloud Infrastructure (OCI) Free Tier: Oracle offers 4 Arm-based Ampere A1 cores and 24 GB of RAM completely free. You can use this offer to run either 1 big VM of 4 cores and 24 GB RAM or split them in 4 VMs of 1 core and 6 GB RAM. Oracle is the only one who offers this generous free tier VM usage.
- Google Cloud Platform (GCP) E2-micro: GCP provides one e2-micro virtual machine instance completely free each month under it’s Always Free tier. The instance features 2 shared vCPUs, 1 GB RAM, up to 30 GB of Standard Persistent Disk and up to 1 GB of free network egress. Instance is only eligible for free tier if it’s deployed from following US regions i.e. US West 1 (Oregon), US Central 1 (Iowa), or US East 1 (South Carolina).
To use them effectively you might need to connect it to Daestro for remote job execution.
#4 Serverless Containers
If your docker jobs are event driven and after it completes you want it to scale down to zero then serverless platform will be good fit. Also the usage of serverless platforms are charged on per-second basis, which would be beneficial for event driven short-lived jobs.
- Google Cloud Run: Cloud Run is fully managed serverless container platform that automatically scales container images from any registry. Cloud Run has following execution model for jobs: Manual execution, using Scheduler or using Workflows. It can auto scale to independent tasks that run sequentially or in parallel.
- AWS Lambda: Lambda is serverless, pay-as-you-go compute engine from AWS which runs container workloads for you without you managing the underlying infrastructure. However to use Lambda you need to push your OCI image to Amazon Elastic Container Registry. AWS Lambda is only appropriate for jobs that run for less than 15 minutes at each invocation.
#5 Low Cost Cloud VPS
If you have exhausted/surpassed all the options mentioned above then you can rent a cheap Linux VPS and manage them yourself (or Daestro), this will give you the best price-to-performance ratio.
- DigitalOcean / Linode / Vultr: Linux VMs from these cloud providers offer best price-to-performance ratio. The pricing for 1 vCPU, 1 GB RAM starts at around $5/month (fixed). These VMs also have local SSD or NVMe drives based on their configuration, which unlike network connected storage offer excellent IOPS.
- Hetzner: Hetzner is excellent choice if you want to rent bare metal servers. They offer wide range of bare metal servers starting from as low as $68.9. Use them if your jobs are CPU or Memory intensive, Hetzner gives best price-to-performance ratio when it comes to bare metal server.