1
2

More than 3 years have passed since last update.

pryでrails+dockerのデバックをする

Last updated at Posted at 2020-08-22

この記事の目的

  • rails
  • docker

でpryを使ったデバックをするまでをまとめる

dockerの設定

docker-compose.yml
services:
  web:
    stdin_open: true
    tty: true
  • stdin_open・・・コンテナの標準入力をオープンしたままにする
  • tty・・・コンテナに疑似TTYを割り当てる

gem

group :development, :test do
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'pry-rails'
  gem 'pry-byebug'
  gem 'pry-doc'
end

実際にByebugを使う場合

dockerを立ち上げ、

docker ps

でwebのidを調べる。

docker attach <container name or ID>

byebugを走らせたいところに

binding.pry

参考文献

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2