We are building a local development environment with Docker and rerunning the Rails tutorial.
--Rails 6 compatible with the latest version of Rails tutorial (as of 2020.8.6) --Development environment can be reproduced using Docker --Do not install in the local environment as much as possible
This time, the part corresponding to Chapter 7 of the Rails tutorial, I will introduce the contents to debug when developing on the Docker container
Personally developed app
mdClip
When operating on the Docker container, use the terminal command as appropriate.
$ docker-compose run app ...
Or
$ docker-compose exec app ...
Please replace with.
Reference site Enable debugging in Docker and Rails 5.2 development environment-Coconala Yomoyama Blog
$ docker attach $(docker-compose ps -q app)
You can now use the debug console
If you exit debug with quit
Since the container will be terminated, rails server
will also drop
If you think this is very inconvenient
If you just detach from the container (Control P
-> Control Q
), you don't have to close the container.
However, when operating with the VS Code console
Control P
, Control Q
cannot be assigned to other shortcuts
This is a solution by replacing the touch keys with a container
Reference article How to solve Ctrl-p double press problem (detach-keys problem) with docker-Qiita
Write the settings in ~ / .docker / config.json
vi ~/.docker/config.json
{
# ...abridgement
"detachKeys": "ctrl-e"
}
I set it to be detachable with control + e
From the debug function of VS code, there seems to be a way to set up a container for debugging and debug.
Developing inside a Container using Visual Studio Code Remote Development
I thought it would be seamless and convenient I've spent a little time so far, so I'll add it on another occasion.
Personal notes
Get started with development Containers in Visual Studio Code
VS Code --Connect to a Rails app running on Docker Compose with Remote Containers-Coffee simmered
Troubleshoot
Both are due to different versions of Bootstrap I don't think it makes sense to spend too much time researching it.
You may want to match the Bootstrap version
#Before correction
col-md-offset-3
#Revised
offset-md-3
$text-danger: #dc3545;
# ...Omission...
.field_with_errors {
@extend .has-error;
.form-control {
color: $text-danger;
}
}
.has-error
-> :invalid
$text-danger: #dc3545;
# ...Omission...
.field_with_errors {
@extend :invalid;
.form-control {
color: $text-danger;
}
}
Recommended Posts