[For those who create portfolios] How to use binding.pry with Docker

While creating the portfolio, I was making it by referring to this article to deploy to Heroku using docker and CircleCI. I will tell you how to introduce it when you want to use binding.pry.

docker-compose.yml


version: '3'
services:
  db:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: root
    ports:
      - "4306:3306"

  web:
    build: .
    command: rails s -p 3000 -b '0.0.0.0'
    environment:
      RAILS_ENV: development
    volumes:
      - .:/sample_app #Set your own app directory name
    ports:
      - "3000:3000"
    links:
      - db

From the above state ① command: rails s -p 3000 -b Delete '0.0.0.0' ②tty: true

Click here for the final shape

docker-compose.yml



version: '3'
services:
  db:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: root
    ports:
      - "4306:3306"
  web:
    build: .
    environment:
      RAILS_ENV: development
    volumes:
      - .:/sample_app
    ports:
      - "3000:3000"
    links:
      - db
    tty: true

③docker-compose up ④docker-compose exec web bash ⑤rails s -p 3000 -b '0.0.0.0' ⑥ Insert binding.pry as you like

reference

https://qiita.com/gakinchoy7/items/ae31107ef56efb16fe7e https://stackoverflow.com/questions/35211638/how-to-debug-a-rails-app-in-docker-with-pry

Recommended Posts

[For those who create portfolios] How to use binding.pry with Docker
[For those who create portfolios] How to use chart kick
How to use nginx-ingress-controller with Docker for Mac
[For those who create portfolios] Search function created with ransack
How to use binding.pry for view files
[Rails] How to use rails console with docker
How to use docker compose with NVIDIA Jetson
How to build docker environment with Gradle for intelliJ
How to make Laravel faster with Docker for Mac
How to use mysql with M1 mac Docker preview version
How to use binding.pry [53 days left]
How to use mssql-tools with alpine
[Artifactory] How to use Docker repository
Ubuntu proxy settings (for those who are having trouble with on-campus proxies, assuming environment to use Docker, kubernetes, etc.)
How to use Mali Graphics Debugger to debug apps for Android (even those made with + Unity)
How to share files with Docker Toolbox
How to use BootStrap with Play Framework
[For those who create portfolios] Reduce mistakes and make the code easier to read -Rubocop Airbnb-
How to create a Maven repository for 2020
How to use Docker in VSCode DevContainer
Create Docker to use Edge TPU compiler
Understand in 5 minutes !! How to use Docker
How to quickly create a reverse proxy that supports HTTPS with Docker
[Docker] How to create a virtual environment for Rails and Nuxt.js apps
[Java] How to test for null with JUnit
How to create a database for H2 Database anywhere
How to use MyBatis2 (iBatis) with Spring Boot 1.4 (Spring 4)
How to use built-in h2db with spring boot
How to use an array for HashMap keys
A note for those who live with JMockit
How to use Java framework with AWS Lambda! ??
How to create multiple pull-down menus with ActiveHash
How to use Java API with lambda expression
How to give your image to someone with docker
How to use nfs protocol version 2 with ubuntu 18.04
[Rails] How to use Gem'rails-i18n' for Japanese support
How to create member variables with JPA Model
[Rails] How to build an environment with Docker
[For super beginners] How to use autofocus: true
How to start with Hyper-V instead of WSL2 on Docker Desktop for Windows
[Introduction to Docker] Create a Docker image for machine learning and use Jupyter notebook
In the topic of "total concentration", "How to use Docker" is summarized for the virtual Mameko who sleeps in me.
[Rails] How to create a signed URL for CloudFront
How to build Docker + Springboot app (for basic learning)
How to use an array for a TreeMap key
How to use Map
How to use Oracle JDK 9 EA with Travis CI
How to use with_option
How to use fields_for
How to use java.util.logging
How to use map
For those who want to use MySQL for the database in the environment construction of Rails6 ~.
How to deal with No template for interactive request
How to use Z3 library in Scala with Eclipse
How to use collection_select
[Spring Boot] How to create a project (for beginners)
Use Puphpeteer with Docker
[Docker environment] How to deal with ActiveSupport :: MessageEncryptor :: InvalidMessage
How to use Twitter4J
`bind': Address already in use --bind (2) for 127.0.0.1:3000 (Errno :: EADDRINUSE) How to deal with the error
How to use active_hash! !!