‘You must use Bundler 2 or greater with this lockfile.’ even with Bundler 2.0.2 installed

I’m trying to Dockerize my Rails app and constantly getting this warning when running docker build -t tml_portal:

Sending build context to Docker daemon  355.1MB
Step 1/1 : FROM rails:onbuild
# Executing 4 build triggers
 ---> Using cache
 ---> Using cache
 ---> Running in 641c1404bf87
You must use Bundler 2 or greater with this lockfile.
The command '/bin/sh -c bundle install' returned a non-zero code: 20

I’ve tried bundler update --system, gem uninstall bundler, gem install bundler 2.0.2, etc. Basically every suggestion on the internet. I will say that I have a problem sometimes where if I switch directories, RVM switches to ruby 2.3.3 and I have to rvm use 2.6.5. My system ruby is not the same as local. Not sure if that has anything to do with it but I just can’t figure out a solution. I’ve also made sure to delete the Docker build cache.

Source: StackOverflow