Home>
I want to debug using pry on rails.
Therefore, I installed the gem, wrote binding.pry in an arbitrary place, and executed it, but the console did not work.
As for the development environment, since we are using the docker environment, we found that it was necessary to check the console inside the container.
From this, I modified it so that pry can be used even in the docker environment.
version: '3'
services: services:
app:
build:
context: ..
environment: environment:
RAILS_ENV: development
MYSQL_ROOT_PASSWORD: db_root_password
MYSQL_USER: app
MYSQL_PASSWORD: password
MYSQL_DATABASE: my_app_development
DATABASE_HOST: db
command: bundle exec puma -C config/puma.rb
--------------------- ↓ Two newly added lines ↓
stdin_open: true
tty: true
---------------------
volumes:
--.:/My_app
--public-data:/my_app/public
--tmp-data:/my_app/tmp
--log-data:/my_app/log
depends_on:
--db
db:
image: mysql: 5.7
environment: environment:
MYSQL_ROOT_PASSWORD: db_root_password
MYSQL_USER: app
MYSQL_PASSWORD: password
MYSQL_DATABASE: my_app_development
DATABASE_HOST: db
volumes:
--db-data:/var/lib/mysql
ports: ports:
-"33 16: 3306"
web:
build:
context: containers/nginx
volumes:
--public-data:/my_app/public
--tmp-data:/my_app/tmp
ports: ports:
-"3000:80"
depends_on:
--app
volumes:
public-data:
tmp-data:
log-data:
db-data:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a43a90dcab74 my_app_web "/ bin/sh -c'/ usr/sb…" 42 minutes ago Up 42 minutes 0.0.0.0:3000->80/tcp my_app_web_1
00f15cac162f my_app_app "bundle exec puma -C…" 42 minutes ago Up 42 minutes my_app_app_1
00d88ac1c7a9 mysql: 5.7 "docker-entrypoint.s…" 6 days ago Up 42 minutes 33060/tcp, 0.0.0.0:3316->3306/tcp my_app_db_1
class UsersController</pre>
<pre><code data-language = "terminal">$docker attach my_app_app_1
It should work with, but it does not work even if reloaded with a browser or command, and it is in a state where debugging is not possible.
What are the possible causes?
The sites I referred to are as follows
Run binding.pry on docker
-
Answer # 1
Related articles
- ruby - i want to build a rails environment on docker, but i can't get an error
- ruby - [docker environment] how to deal with errors during rails db: migrate
- ruby on rails - [docker] rails s -b 0000 => cannot render console from 1722801!
- error in building environment of ruby on rails
- ruby on rails - [docker] mysql2 :: error :: connectionerror: unknown mysql server host'db' (-2)
- ruby on rails - [docker] i get an error when i run rails db: migrate
- ruby on rails - about aws environment variables
- i built an environment for docker, ruby on rails and mysql, but i can't access it on localhost3000
- ruby on rails 3 - i'm trying to build a ruby on rails environment with docker, but it doesn't work
- ruby on rails - docker file is not up
- ruby on rails - in rails + nginx + aws + rds t2micro (memory 1g) environment, puma crashes when displaying a database of 20000 r
- ruby on rails - i'm trying to build a rails environment on docker, but it doesn't work
- ruby on rails - i can't log in to the app in the production environment (the app that was successfully deployed on heroku)
- ruby on rails - in the development of docker + rails + puma + nginx, i want to check the puma log in real time (also for debuggi
- ruby on rails - i want to be able to send emails from the rails production environment
- ruby on rails - environment construction rbenv installation next path does not pass
- ruby on rails 6 - environment construction of ruby on rails
- ruby on rails - [aws production environment] regarding http error 406
- ruby - partial template is not displayed (rails)
Related questions
- ruby on rails - i'm trying to build a rails environment on docker, but it doesn't work
- ruby on rails - i'm trying to create a container in docker but it doesn't work i want to create a container
- mysql - about $docker exec -it container name/bin/bash of docker
- ruby - an error occurs when building a rails 6 environment with docker
- ruby on rails - [docker] rails s -b 0000 => cannot render console from 1722801!
- php : DockerFile is in under the folder, from there Copy is not done, wipes the error that finds a composer.json file
- ubuntu : Docker-Compose installation problem
- Virtual hosts in NGINX from outside in Docker
- I can not open static files, doctorization. Permission Denied, Cannot Open Static Files, Docker, Django
- php : Docker: invalid reference format
For debugging, I gave up the dcoker environment and made it work on the host.