Sean

CapRover Deploying with the Wrong Platform

- 400 words

At a Glance

I had two versions of the ruby:4.0 Docker image, one for linux/amd64 and one for linux/arm64/v8. For reasons we still don’t know, CapRover was using the linux/arm64/v8 version for deployment.

By running docker image rm ruby:4.0 and redeploying my application it was built using the image form the linux/amd64 platform.

The Problem

Recently when I deployed my web applications to CapRover they were using the images for the linux/arm64/v8 platform instead of the linux/amd64 that my server actually is1. Whilst this technically worked it had massive performance penalties because I was running everything through QEMU as that’s how I have Docker multi-platform setup.

Strangely when running docker build . in the project root on the server used the correct linux/amd64 platform.

I had absolutely no idea why this was happening. I dove into the CapRover code and it didn’t specify the platform anywhere. I got so lost with this I actually raised an issue on their GitHub

The Work Around

githubsaturn was very patient and incredibly helpful in working around this issue. By running docker image rm ruby:4.0 and redeploying an effected application using that image it deployed correctly using the linux/amd64 platform. As I have a fair few of these non-linux/amd64 images on my server due to testing [neospec] and [LocalCI] I have written a script to clean them up.

  1. Download the script
  2. Run chmod +x docker-clean-other-platforms to make it executable
  3. Run ./docker-clean-other-platforms.

Dangling Threads

I don’t consider this “case closed” as I want images with other platforms on my system for testing my Ruby gems.

My big suspicion is that it has something to do with running Docker inside of Docker. I suspect that because installing CapRover is done with the command docker run -p 80:80 -p 443:443 -p 3000:3000 -e ACCEPTED_TERMS=true -v /var/run/docker.sock:/var/run/docker.sock -v /captain:/captain caprover/caprover. Which means everything CapRover doe does with Docker is done through that container.

If I ever figure out why this is actually happening and how to permanently fix it I’ll update this blog post, but for now I think I’ll leave it there.

  1. Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz