Add the Sidekiq gem to the Gemfile and run bundle install
Once the gem is installed create a sidekiq.yml file under the config directory. Specify the desired concurrency and queue names (you can have multiple, i.e. default, high, low)
Once the sidekiq.yml is created, you will need to setup the server and client initializers. Create a sidekiq.rb file under config/initializers that establishes Sidekiq's connection to Redis.
The last step is to setup a Dockerfile and docker-compose.yml file to bring the services up. You will need to define two services redis and sidekiq.
The redis service will pull a standard Redis image and run on port 6379 on the host. As part of the setup a password is added and the redis data is setup to store in the volume tmp/db on the host.
The sidekiq service builds its image from the Ruby project Dockerfile (i.e.build: .). This means we need to create a Dockerfile in the root of the Ruby project directory. We will use a Sinatra application as an example with a ruby:2.5.7-alpine image.
This Dockerfile installs the necessary dependencies and setups an application called APP (mapping to /app) for our application. With this file available we can complete the docker-compose.yml file .
Run docker-compose up and your services should be running.