Skip to content

Commit

Permalink
Add container_names for docker commands
Browse files Browse the repository at this point in the history
container_names make it possible to run docker commands
without looking up container hash
use in dev.yml
  • Loading branch information
hanhanhan committed Apr 24, 2020
1 parent 1838ba3 commit f9c20af
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Listed in alphabetical order.
Guilherme Guy `@guilherme1guy`_
Hamish Durkin `@durkode`_
Hana Quadara `@hanaquadara`_
Hannah Lazarus `@hanhanhan`_
Harry Moreno `@morenoh149`_ @morenoh149
Harry Percival `@hjwp`_
Hendrik Schneider `@hendrikschneider`_
Expand Down
9 changes: 9 additions & 0 deletions docs/developing-locally-docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ django-debug-toolbar
In order for ``django-debug-toolbar`` to work designate your Docker Machine IP with ``INTERNAL_IPS`` in ``local.py``.


docker
""""""

The ``container_name`` from the yml file can be used to check on containers with docker commands, for example: ::

$ docker logs worker
$ docker top worker


Mailhog
~~~~~~~

Expand Down
8 changes: 8 additions & 0 deletions {{cookiecutter.project_slug}}/local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
context: .
dockerfile: ./compose/local/django/Dockerfile
image: {{ cookiecutter.project_slug }}_local_django
container_name: django
depends_on:
- postgres
{%- if cookiecutter.use_mailhog == 'y' %}
Expand All @@ -29,6 +30,7 @@ services:
context: .
dockerfile: ./compose/production/postgres/Dockerfile
image: {{ cookiecutter.project_slug }}_production_postgres
container_name: postgres
volumes:
- local_postgres_data:/var/lib/postgresql/data
- local_postgres_data_backups:/backups
Expand All @@ -38,6 +40,7 @@ services:

mailhog:
image: mailhog/mailhog:v1.0.0
container_name: mailhog
ports:
- "8025:8025"

Expand All @@ -46,10 +49,12 @@ services:

redis:
image: redis:5.0
container_name: redis

celeryworker:
<<: *django
image: {{ cookiecutter.project_slug }}_local_celeryworker
container_name: celeryworker
depends_on:
- redis
- postgres
Expand All @@ -62,6 +67,7 @@ services:
celerybeat:
<<: *django
image: {{ cookiecutter.project_slug }}_local_celerybeat
container_name: celerybeat
depends_on:
- redis
- postgres
Expand All @@ -74,6 +80,7 @@ services:
flower:
<<: *django
image: {{ cookiecutter.project_slug }}_local_flower
container_name: flower
ports:
- "5555:5555"
command: /start-flower
Expand All @@ -86,6 +93,7 @@ services:
context: .
dockerfile: ./compose/local/node/Dockerfile
image: {{ cookiecutter.project_slug }}_local_node
container_name: node
depends_on:
- django
volumes:
Expand Down

0 comments on commit f9c20af

Please sign in to comment.