# Proposal: Kamal gets ruby version build arg from ruby itself

**URL:** <https://discuss.rubyonrails.org/t/proposal-kamal-gets-ruby-version-build-arg-from-ruby-itself/90162>\
**Category:** rubyonrails-core\
**Tags:** feature\
**Created:** [February 22, 2026, 1:52pm UTC](https://discuss.rubyonrails.org/t/proposal-kamal-gets-ruby-version-build-arg-from-ruby-itself/90162 "2026-02-22T13:52:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kelly\_Stannard](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/kelly_stannard/32/3824_2.png) [@Kelly\_Stannard](https://discuss.rubyonrails.org/u/Kelly_Stannard)\
**Post date:** [February 22, 2026, 1:52pm UTC](https://discuss.rubyonrails.org/t/proposal-kamal-gets-ruby-version-build-arg-from-ruby-itself/90162/1 "2026-02-22T13:52:16Z")

</div>

Problem: The ruby version currently is duplicated at least once in a new Rails app that uses Kamal. “.ruby-version” and “Dockerfile”.

Proposal: Have the “deploy.yml.tt” generator have the following:

```ruby
builder:
  ...
  args:
    RUBY_VERSION: <%= "\<%= Gem.ruby_version %>" %>

```

How will this solve the problem? For the default use case, Kamal is a ruby script running with the Ruby version the app uses. This means, with the above change, the builder will pass the correct Ruby version to Docker, overriding the RUBY\_VERSION in the Dockerfile.

---

<div class="post-metadata">

**Author:** ![pavlik](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/pavlik/32/9554_2.png) [@pavlik](https://discuss.rubyonrails.org/u/pavlik)\
**Post date:** [February 26, 2026, 5:52pm UTC](https://discuss.rubyonrails.org/t/proposal-kamal-gets-ruby-version-build-arg-from-ruby-itself/90162/2 "2026-02-26T17:52:41Z")

</div>

The way I understand it .ruby\_version is a declaration what ruby version is required for this project,

Dockerfile has it’s own mechanism to set up the world, so this requirement is fulfilled.

So I’d rather look for a way for Dockerfile to get version from .ruby\_version file, than telling bundler “the required version is whatever version currently available”.

---

<div class="post-metadata">

**Author:** ![Kelly\_Stannard](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/kelly_stannard/32/3824_2.png) [@Kelly\_Stannard](https://discuss.rubyonrails.org/u/Kelly_Stannard)\
**Post date:** [April 14, 2026, 11:18am UTC](https://discuss.rubyonrails.org/t/proposal-kamal-gets-ruby-version-build-arg-from-ruby-itself/90162/3 "2026-04-14T11:18:49Z")

</div>

That is what this does. Kamal can only be run from the app directory AFAIK, which means that Gem.ruby\_version is the same as the version in the file. Gem.ruby\_version also handles apps that are not using .ruby\_version.
