The Ruby image based on Redhat UBI.
A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.
See: https://www.ruby-lang.org
# specify the ruby base image with your desired version ruby:<version>-<ubi-version>
FROM ruby:3.2.2-ubi9
# replace this with your application's default port
EXPOSE 8888
You can then build and run the Docker image:
$ docker build -t my-ruby-app .
$ docker run -it --rm --name my-running-app my-ruby-app
If you prefer Docker Compose:
version: "2"
services:
ruby:
image: "ruby-ubi:3.2.2-ubi9"
working_dir: /app
expose:
- "8081"
command: "ruby app.rb"
You can then run using Docker Compose:
$ docker-compose up -d
For many simple, single file projects, you may find it inconvenient to write a
complete Dockerfile
. In such cases, you can run a Ruby script by using the
Ruby Docker image directly:
$ docker run -it --rm --name my-running-script -v "$PWD":/app -w /app ruby-uby:3.2.2-ubi9 ruby your-daemon-or-script.rb
The ruby-ubi
images come in many flavors, each designed for a specific use case.
All of the images contain pre-installed versions of ruby
,
bundle
. For each
supported architecture, the supported variants are different.
This image is based on version 9 of
UBI, available in
the ubi9
official image.
This image is based on version 8 of
UBI, available in
the ubi8
official image.
License information for the Ruby UBI Docker project.
This image is officially supported on Docker version 1.9.1.
Support for older versions (down to 1.6) is provided on a best-effort basis.
Please see the Docker installation documentation for details on how to upgrade your Docker daemon.
This project will support Ruby versions as still under active support as per the Ruby Maintenance Branches.