mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-07-31 10:19:54 +03:00
Update docker_remote_debugging.rst
Docker Remote Debugging
This commit is contained in:
parent
a57af695cc
commit
785aadda40
|
@ -1,11 +1,44 @@
|
|||
Docker Remote Debugging
|
||||
=======================
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque lobortis pharetra rutrum. Nulla finibus metus eget egestas facilisis. Sed non turpis at neque rhoncus vestibulum. Duis tristique augue nibh, at rhoncus orci vulputate ut. Aenean auctor vel magna nec pellentesque. Cras porta vestibulum tortor in sodales. Phasellus tempor arcu et mi faucibus, vel finibus massa tristique.
|
||||
To connect to python remote interpreter, ssh connection has to be established. You may have heard about article |docker-ssh-considered-evil|_
|
||||
|
||||
.. _docker-ssh-considered-evil: https://jpetazzo.github.io/2014/06/23/docker-ssh-considered-evil/
|
||||
.. |docker-ssh-considered-evil| replace:: *If you run SSHD in your Docker containers, you're doing it wrong!*
|
||||
|
||||
|
||||
There is a better tool to login into container if you want to access to shell, i.e. `docker exec`_. However, connecting to remote interpreter is a different thing, much more difficult. You can read more about `attempts on StackOverflow`_.
|
||||
|
||||
.. _docker exec: https://docs.docker.com/reference/commandline/exec/
|
||||
.. _attempts on StackOverflow: http://stackoverflow.com/a/28675525/338581
|
||||
|
||||
To avoid putting sshd into production-ready docker image, we create another docker image on top of main ``{{ cookiecutter.repo_name|replace('_', '') }}_django`` image from `compose/pycharm/Dockerfile <../compose/pycharm/Dockerfile>`_. That's why you have to first build main `Dockerfile <../Dockerfile>`_, and you can do that by::
|
||||
|
||||
$ docker-compose -f dev.yml build
|
||||
|
||||
After that, you can build and run debug container::
|
||||
|
||||
$ docker-compose -f debug.yml build
|
||||
$ docker-compose -f debug.yml up
|
||||
|
||||
Container should be ready, when::
|
||||
|
||||
...
|
||||
debug_1 | Starting OpenBSD Secure Shell server: sshd
|
||||
...
|
||||
|
||||
will be displayed in docker-compose logs.
|
||||
|
||||
You can test ssh conection using password *docker*, by::
|
||||
|
||||
ssh docker_{{ cookiecutter.repo_name }}@localhost -p 2222
|
||||
|
||||
or you can also use ssh-key::
|
||||
|
||||
ssh -i compose/pycharm/.ssh_keys_to_docker/id_rsa docker_{{ cookiecutter.repo_name }}@localhost -p 2222
|
||||
|
||||
Proin vestibulum placerat orci ac ultricies. Pellentesque consectetur enim eget ex convallis, ut volutpat felis tincidunt. Sed magna purus, fringilla vitae lectus mattis, finibus hendrerit sapien. Mauris aliquam arcu maximus quam eleifend, sit amet aliquet orci porta. Nulla facilisi. Nulla pharetra augue pellentesque mauris consequat, sed porta magna accumsan. Etiam eget neque eget dolor feugiat rhoncus.
|
||||
|
||||
PyCharm
|
||||
^^^^^^^
|
||||
|
||||
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae tellus eros. Etiam faucibus consectetur sem, in pharetra mi semper sed. Proin dignissim orci eget ante pulvinar semper. Mauris scelerisque gravida elit vitae dapibus. Morbi tincidunt leo vulputate, ornare ipsum vel, gravida purus. Mauris sed commodo ex. Fusce id enim arcu. Phasellus ultricies lorem nulla, vitae luctus mauris lobortis a. Aenean ac mauris ut neque semper egestas. Nullam ac elementum nunc.
|
||||
This repository comes with already prepared "Run/Debug Configurations" for docker
|
||||
|
|
Loading…
Reference in New Issue
Block a user