hashicorp / terraform-aws-consul

A Terraform Module for how to run Consul on AWS using Terraform and Packer
Apache License 2.0
399 stars 482 forks source link

Cannot complete install-dnsmasq with docker #245

Open queglay opened 2 years ago

queglay commented 2 years ago

Describe the bug If we run install-consul and install-dnsmasq, restarting the service is required, but docker has permissions issues doing this.

To Reproduce Build with these lines in docker ( I'm using the container public.ecr.aws/codebuild/amazonlinux2-x86_64-standard:3.0 ):

RUN git clone https://github.com/hashicorp/terraform-aws-consul.git /tmp/terraform-aws-consul

RUN /tmp/terraform-aws-consul/modules/install-consul/install-consul --version "1.9.2"

RUN /tmp/terraform-aws-consul/modules/install-dnsmasq/install-dnsmasq

RUN service dnsmasq restart

Errors with:

Step 12/13 : RUN /tmp/terraform-aws-consul/modules/install-dnsmasq/install-dnsmasq
 ---> Using cache
 ---> a568968bbf5b
Step 13/13 : RUN service dnsmasq restart
 ---> Running in 748942c25237
Redirecting to /bin/systemctl restart dnsmasq.service
Failed to get D-Bus connection: Operation not permitted

I also tried according to the readme:

RUN /etc/init.d/dnsmasq restart

...but that path is incorrect:

 ---> a568968bbf5b
Step 13/13 : RUN /etc/init.d/dnsmasq restart
 ---> Running in 83873b284ef6
/bin/sh: /etc/init.d/dnsmasq: No such file or directory

I'm guessing it would have the same permissions issues anyway.

Expected behavior It should be possible to restart dnsmasq for use with docker.