nib is a
docker-compose wrapper geared towards Ruby/Rails development.
> gem install nib
If there is an update available it's a good idea to remove the current version before installing the new version. If you skip the uninstall then
gem update nib will install the new version along side the existing version.
> gem uninstall -ax nib && gem install nib
nib can be used as a replacement for
docker-compose any commands that it does not recognize will be delegated to
The commands provided by
nib are intended to provide a convenient and practical workflow for development, for example:
> nib shell web root@fd80bbc4ab5a:/usr/src/app#
nibwill start up a container for the
webservice and drop you into an interactive shell session (
sh) depending on which shell is available.
nibwill also hook up a history file for your shell session (relative to the current project). This means that you will be able to use the history (up arrow) in future shell sessions, something that is not available with vanilla docker/docker-compose!
nibwill ensure that the container is removed after you finish with the shell session
Some commands can have their behavior changed relative to a particular project. As an example -
nib console expects a Ruby like environment (
rails console or
pry etc) by default but it can be augmented by adding a custom script on the host system (
Other commands like
nib rake or
nib guard behave as expected without the option to change the behavior.
For additional information and a list of supported commands review the help system.
> nib help
nib can help facilitate remote debugging of a running byebug server inside of a rails application. In order to make this work there are a couple of steps you'll need to take first.
byebug gem to your Gemfile if it's not already present.
# Gemfile gem 'byebug'
Enable byebug server for development. This will default the port to 9005 but that can be overridden by setting the
RUBY_DEBUG_PORT environment variable (see below).
# config/envrionments/development.rb require 'byebug/core' Byebug.start_server '0.0.0.0', (ENV.fetch 'RUBY_DEBUG_PORT', 9005).to_i
Expose the desired port and specify the
RUBY_DEBUG_PORT environment variable (overrides the default).
# docker-compose.yml web: ... ports: - "3001:3001" environment: - "RUBY_DEBUG_PORT=3001"
Once all of this is in place and the web service is up and running (
nib up) you can use the
debug command to attach to the remote debugger.
> nib debug web
nib build # the first time (you are using `nib` right?) nib rspec gem
If you have added a new command you will want to regenerate the commands document. The following command should get that done:
docker run \ --rm \ -v $PWD:/usr/src/app \ -w /usr/src/app \ ruby:alpine bin/update_docs
nib is work of several contributors. You're encouraged to submit pull requests, propose features and discuss issues.
MIT License. See LICENSE for details.