# Ansible install packages in docker image is hung.

**URL:** <https://forum.ansible.com/t/ansible-install-packages-in-docker-image-is-hung/32143>\
**Category:** Ansible Project\
**Created:** [February 5, 2020, 9:17am UTC](https://forum.ansible.com/t/ansible-install-packages-in-docker-image-is-hung/32143 "2020-02-05T09:17:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Toan\_Huynh\_Van](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@Toan\_Huynh\_Van](https://forum.ansible.com/u/Toan_Huynh_Van)\
**Post date:** [February 5, 2020, 9:17am UTC](https://forum.ansible.com/t/ansible-install-packages-in-docker-image-is-hung/32143/1 "2020-02-05T09:17:48Z")

</div>

Hi all,

I am using ansible to install packages for docker image but it’s hung with messages below. Can you have a look and give me advice?

docker: “stderr\_lines”: [  
docker: “”,  
docker: “Extracting templates from packages: 5%”,  
docker: “Extracting templates from packages: 10%”,  
docker: “Extracting templates from packages: 16%”,  
docker: “Extracting templates from packages: 21%”,  
docker: “Extracting templates from packages: 27%”,  
docker: “Extracting templates from packages: 32%”,  
docker: “Extracting templates from packages: 37%”,  
docker: “Extracting templates from packages: 43%”,  
docker: “Extracting templates from packages: 48%”,  
docker: “Extracting templates from packages: 54%”,  
docker: “Extracting templates from packages: 59%”,  
docker: “Extracting templates from packages: 64%”,  
docker: “Extracting templates from packages: 70%”,  
docker: “Extracting templates from packages: 75%”,  
docker: “Extracting templates from packages: 81%”,  
docker: “Extracting templates from packages: 86%”,  
docker: “Extracting templates from packages: 91%”,  
docker: “Extracting templates from packages: 97%”,  
docker: “Extracting templates from packages: 100%”,  
docker: “”,  
docker: “Current default time zone: ‘Etc/UTC’”,  
docker: “Local time is now: Wed Feb 5 09:02:44 UTC 2020.”,  
docker: “Universal Time is now: Wed Feb 5 09:02:44 UTC 2020.”,  
docker: “Run ‘dpkg-reconfigure tzdata’ if you wish to change it.”,  
docker: “”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “Building database of manual pages …”,  
docker: “update-initramfs: deferring update (trigger activated)”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “”,  
docker: “Creating config file /etc/gconf/2/path with new version”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “invoke-rc.d: unknown initscript, /etc/init.d/cgroup-lite not found.”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match saslauthd Default-Stop values (1)”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “update-rc.d: warning: stop runlevel arguments (1) do not match snmpd Default-Stop values (0 1 6)”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “”,  
docker: “Creating config file /etc/default/sysstat with new version”,  
docker: “update-alternatives: using /usr/bin/sar.sysstat to provide /usr/bin/sar (sar) in auto mode”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “invoke-rc.d: unknown initscript, /etc/init.d/systemd-logind not found.”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “”,  
docker: “(gconftool-2:8576): GConf-WARNING \*\*: Client failed to connect to the D-BUS daemon:”,  
docker: “Unable to autolaunch a dbus-daemon without a $DISPLAY for X11”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”,  
docker: “invoke-rc.d: policy-rc.d denied execution of start.”  
docker: ],

Thanks

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [February 5, 2020, 9:22am UTC](https://forum.ansible.com/t/ansible-install-packages-in-docker-image-is-hung/32143/2 "2020-02-05T09:22:16Z")

</div>

> Hi all,
> 
> I am using ansible to install packages for docker image but it's hung with messages below. Can you have a look and give  
> me advice?
> 
> ```
> docker: &quot;stderr\_lines&quot;: \[
> docker: &quot;&quot;,
> docker: &quot;Extracting templates from packages: 5%&quot;,
> docker: &quot;Extracting templates from packages: 10%&quot;,
> docker: &quot;Extracting templates from packages: 16%&quot;,
> docker: &quot;Extracting templates from packages: 21%&quot;,
> docker: &quot;Extracting templates from packages: 27%&quot;,
> docker: &quot;Extracting templates from packages: 32%&quot;,
> docker: &quot;Extracting templates from packages: 37%&quot;,
> docker: &quot;Extracting templates from packages: 43%&quot;,
> docker: &quot;Extracting templates from packages: 48%&quot;,
> docker: &quot;Extracting templates from packages: 54%&quot;,
> docker: &quot;Extracting templates from packages: 59%&quot;,
> docker: &quot;Extracting templates from packages: 64%&quot;,
> docker: &quot;Extracting templates from packages: 70%&quot;,
> docker: &quot;Extracting templates from packages: 75%&quot;,
> docker: &quot;Extracting templates from packages: 81%&quot;,
> docker: &quot;Extracting templates from packages: 86%&quot;,
> docker: &quot;Extracting templates from packages: 91%&quot;,
> docker: &quot;Extracting templates from packages: 97%&quot;,
> docker: &quot;Extracting templates from packages: 100%&quot;,
> docker: &quot;&quot;,
> docker: &quot;Current default time zone: &#39;Etc/UTC&#39;&quot;,
> docker: &quot;Local time is now: Wed Feb 5 09:02:44 UTC 2020\.&quot;,
> docker: &quot;Universal Time is now: Wed Feb 5 09:02:44 UTC 2020\.&quot;,
> docker: &quot;Run &#39;dpkg\-reconfigure tzdata&#39; if you wish to change it\.&quot;,
> docker: &quot;&quot;,
> docker: &quot;invoke\-rc\.d: policy\-rc\.d denied execution of start\.&quot;,
> docker: &quot;Building database of manual pages \.\.\.&quot;,
> docker: &quot;update\-initramfs: deferring update \(trigger activated\)&quot;,
> docker: &quot;invoke\-rc\.d: policy\-rc\.d denied execution of start\.&quot;,
> docker: &quot;&quot;,
> docker: &quot;Creating config file /etc/gconf/2/path with new version&quot;,
> docker: &quot;invoke\-rc\.d: policy\-rc\.d denied execution of start\.&quot;,
> docker: &quot;invoke\-rc\.d: policy\-rc\.d denied execution of start\.&quot;,
> docker: &quot;invoke\-rc\.d: policy\-rc\.d denied execution of start\.&quot;,
> docker: &quot;invoke\-rc\.d: policy\-rc\.d denied execution of start\.&quot;,
> docker: &quot;invoke\-rc\.d: policy\-rc\.d denied execution of start\.&quot;,
> docker: &quot;invoke\-rc\.d: unknown initscript, /etc/init\.d/cgroup\-lite not found\.&quot;,
> docker: &quot;invoke\-rc\.d: policy\-rc\.d denied execution of start\.&quot;,
> docker: &quot;invoke\-rc\.d: policy\-rc\.d denied execution of start\.&quot;,
> docker: &quot;update\-rc\.d: warning: default stop runlevel arguments \(0 1 6\) do not match saslauthd Default\-Stop
> 
> ```
> 
> values (1)",  
> docker: "invoke-rc.d: policy-rc.d denied execution of start.",  
> docker: "update-rc.d: warning: stop runlevel arguments (1) do not match snmpd Default-Stop values (0 1 6)",  
> docker: "invoke-rc.d: policy-rc.d denied execution of start.",  
> docker: "",  
> docker: "Creating config file /etc/default/sysstat with new version",  
> docker: "update-alternatives: using /usr/bin/sar.sysstat to provide /usr/bin/sar (sar) in auto mode",  
> docker: "invoke-rc.d: policy-rc.d denied execution of start.",  
> docker: "invoke-rc.d: unknown initscript, /etc/init.d/systemd-logind not found.",  
> docker: "invoke-rc.d: policy-rc.d denied execution of start.",  
> docker: "invoke-rc.d: policy-rc.d denied execution of start.",  
> docker: "",  
> docker: "(gconftool-2:8576): GConf-WARNING \*\*: Client failed to connect to the D-BUS daemon:",  
> docker: "Unable to autolaunch a dbus-daemon without a $DISPLAY for X11",  
> docker: "invoke-rc.d: policy-rc.d denied execution of start.",  
> docker: "invoke-rc.d: policy-rc.d denied execution of start.",  
> docker: "invoke-rc.d: policy-rc.d denied execution of start."  
> docker: ],

Are you sure that is a problem related to Ansible? Anyway, you didn't post your playbook or tasks so  
we can't know what you are trying.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Toan\_Huynh\_Van](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@Toan\_Huynh\_Van](https://forum.ansible.com/u/Toan_Huynh_Van)\
**Post date:** [February 5, 2020, 9:37am UTC](https://forum.ansible.com/t/ansible-install-packages-in-docker-image-is-hung/32143/3 "2020-02-05T09:37:52Z")

</div>

I run packer to build docker image and use ansible as provisioner. Below is my playbook:

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [February 5, 2020, 9:52am UTC](https://forum.ansible.com/t/ansible-install-packages-in-docker-image-is-hung/32143/4 "2020-02-05T09:52:17Z")

</div>

> I run packer to build docker image and use ansible as provisioner. Below is my playbook:

I can't see either docker nor packer in your playbook below.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Toan\_Huynh\_Van](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@Toan\_Huynh\_Van](https://forum.ansible.com/u/Toan_Huynh_Van)\
**Post date:** [February 5, 2020, 10:21am UTC](https://forum.ansible.com/t/ansible-install-packages-in-docker-image-is-hung/32143/5 "2020-02-05T10:21:13Z")

</div>

> Here is my packer script:

{  
“builders”: [  
{  
“type”: “docker”,  
“communicator”: “docker”,  
“image”: “{{user `base_image`}}”,  
“commit”: true,  
“run\_command”: [“-d”, “-i”, “-t”, “–name”, “ubuntu\_test”, “{{.Image}}”, “/bin/bash”]  
}  
],  
“provisioners”: [  
{  
“type”: “shell”,  
“inline”: [“apt-get -y update && apt-get install -y python-dev”]  
},  
{  
“type”: “ansible”,  
“user”: “root”,  
“playbook\_file”: “…/ansible/playbook.{{user `image_name`}}.yml”,  
“extra\_arguments”: [“-vvv”, “–vault-password-file”, “…/ansible/vault\_password”, “–extra-vars”, “ansible\_host=ubuntu\_test ansible\_connection=docker ansible\_python\_interpreter=/usr/bin/python”]  
}  
],  
“post-processors”: [  
{  
“type”: “docker-tag”,  
“repository”: “{{user `repository`}}”,  
“tag”: “latest”  
},  
{  
“type”: “docker-tag”,  
“repository”: “{{user `repository`}}”,  
“tag”: “{{user `image_tag`}}”  
},  
{  
“type”: “docker-push”,  
“ecr\_login”: true,  
“login\_server”: “{{user `login_server`}}”,  
“aws\_access\_key”: “”,  
“aws\_secret\_key”: “”,  
“keep\_input\_artifact”: false  
}  
]  
}

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [February 5, 2020, 10:33am UTC](https://forum.ansible.com/t/ansible-install-packages-in-docker-image-is-hung/32143/6 "2020-02-05T10:33:56Z")

</div>

> &nbsp;&nbsp;&nbsp;&nbsp;Here is my packer script:

Sorry, I can't really see a relationship between your Ansible playbook and the error message you posted.  
Did you try to run the playbook manually?

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke
