Building the zone file from the DNS_A environment variable seems to fail in the debian image (tag latest) when the container was created by docker compose. When creating a container from the command line, everything works fine, when creating it via docker compose, the hostname -A command here seems to be returning a hostname containing a space (2e520b409724 2e520b409724 in the log below), messing up the zone file syntax.
I don't have any explanation for why hostname would return different things depending on if the container was created by compose or not or why this problem only occurs for debian and not for alpine. Switching to the alpine tag worked as a workaround for me.
dns_1 | [ERR] Configuration failed.
dns_1 | dns_rdata_fromtext: /etc/bind/custom/zone/rpz:2: near 'admin.2e520b409724': not a valid number
dns_1 | dns_rdata_fromtext: /etc/bind/custom/zone/rpz:11: near '2e520b409724.': extra input text
dns_1 | zone rpz/IN: loading from master file /etc/bind/custom/zone/rpz failed: not a valid number
dns_1 | zone rpz/IN: not loaded due to errors.
dns_1 |
dns_1 | --------------------------------------------------------------------------------
dns_1 | /etc/bind/custom/conf/rpz.conf
dns_1 | --------------------------------------------------------------------------------
dns_1 | zone "rpz" IN {
dns_1 | type master;
dns_1 | allow-transfer { any; };
dns_1 | allow-update { any; };
dns_1 | file "/etc/bind/custom/zone/rpz";
dns_1 | };
dns_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
dns_1 |
dns_1 | --------------------------------------------------------------------------------
dns_1 | /etc/bind/custom/zone/rpz
dns_1 | --------------------------------------------------------------------------------
dns_1 | $TTL 3600
dns_1 | @ IN SOA 2e520b409724 2e520b409724. admin.2e520b409724 2e520b409724. (
dns_1 | 1654539831 ; Serial number
dns_1 | 1200 ; Refresh time
dns_1 | 180 ; Retry time
dns_1 | 1209600 ; Expiry time
dns_1 | 10800 ; Negative Cache TTL
dns_1 | )
dns_1 |
dns_1 | ; NS Records
dns_1 | IN NS 2e520b409724 2e520b409724.
dns_1 |
dns_1 | ; Custom Records
dns_1 | <domain> IN A <ip>
Building the zone file from the
DNS_A
environment variable seems to fail in the debian image (taglatest
) when the container was created by docker compose. When creating a container from the command line, everything works fine, when creating it via docker compose, thehostname -A
command here seems to be returning a hostname containing a space (2e520b409724 2e520b409724
in the log below), messing up the zone file syntax.I don't have any explanation for why
hostname
would return different things depending on if the container was created by compose or not or why this problem only occurs for debian and not for alpine. Switching to the alpine tag worked as a workaround for me.