Utilities #

Service in Docker container can’t write to host filesystem #

Sometimes it happenes in CentOS like distibution.

Simply add :Z to your docker volume definition to give docker permission to write.

- ~/app-data/:/app-data:Z

Docker service can’t talks to other services #

Don’t hardcode service port, use its name.

- KAFKA_HOST=kafka # <---- don't use `KAFKA_HOST=localhost`
image: wurstmeister/kafka
- '9092:9092'

Docker service can’t find other service #

Pay attention to the whitespace in your docker-compose.yml

Code #

Jinja2 loop can’t access iterables attribute and can’t do next operation #

Since jinja2 can’t access iterables attribute correctly, it can’t do next
operation properly such as sort.

The code below doesn’t work:

<!-- Maybe because Jinja2 pipeline doesn't execute by oder as unix does? -->
{% for article in articles if article.pupular_rating|sort(attribute = 'popular_rating') %}
{% endfor %}

However, this will works:

{% for article in articles |selectattr("popular_rating")|sort(attribute = 'popular_rating') %}
{% endfor %}