# Deploy filebeat in docker using a custom Dockerfile with a entry script

**URL:** https://discuss.elastic.co/t/deploy-filebeat-in-docker-using-a-custom-dockerfile-with-a-entry-script/115530
**Category:** Beats
**Tags:** filebeat
**Created:** [January 15, 2018, 11:31am UTC](https://discuss.elastic.co/t/deploy-filebeat-in-docker-using-a-custom-dockerfile-with-a-entry-script/115530 "2018-01-15T11:31:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![vivekthangathurai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivekthangathurai/32/23561_2.png) [@vivekthangathurai](https://discuss.elastic.co/u/vivekthangathurai)
#### Post date: [January 15, 2018, 11:31am UTC](https://discuss.elastic.co/t/deploy-filebeat-in-docker-using-a-custom-dockerfile-with-a-entry-script/115530/1 "2018-01-15T11:31:29Z")

</div>

Hello,  
I am deploying my custom config filebeat using docker with the following docker file.  
FROM [docker.elastic.co/beats/filebeat:5.6.3](http://docker.elastic.co/beats/filebeat:5.6.3)  
COPY filebeat.yml /usr/share/filebeat/filebeat.yml  
USER root  
RUN chown filebeat /usr/share/filebeat/filebeat.yml  
RUN chmod go-w /usr/share/filebeat/filebeat.yml  
COPY change\_config.sh /opt/change\_config.sh  
ENTRYPOINT ["/opt/change\_config.sh"]  
USER filebeat

The /opt/change\_config.sh changes the config file filebeat.yml, add a custom field with a uuid. I need the uuid to attach unique id to each run.

the docker compose creates the filebeat container but the filebeat is not harvesting the log file. When I did a dockers logs on the container, I can see only the change\_config.sh console logs and not of the filebeat [logs.It](http://logs.It) seems the filebeat is actually not running.

---

<div class="post-metadata">

### Author: ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)
#### Post date: [January 15, 2018, 11:48am UTC](https://discuss.elastic.co/t/deploy-filebeat-in-docker-using-a-custom-dockerfile-with-a-entry-script/115530/2 "2018-01-15T11:48:48Z")

</div>

Hi @vivekthangathurai, if you are only changing `filebeat.yml` it is recommended you do it like this: [https://www.elastic.co/guide/en/beats/filebeat/6.1/running-on-docker.html](https://www.elastic.co/guide/en/beats/filebeat/6.1/running-on-docker.html) (either mount or COPY).

You can then use environment variables to set the UUID, check: [https://www.elastic.co/guide/en/beats/filebeat/6.1/using-environ-vars.html](https://www.elastic.co/guide/en/beats/filebeat/6.1/using-environ-vars.html)

---

<div class="post-metadata">

### Author: ![vivekthangathurai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivekthangathurai/32/23561_2.png) [@vivekthangathurai](https://discuss.elastic.co/u/vivekthangathurai)
#### Post date: [January 15, 2018, 4:57pm UTC](https://discuss.elastic.co/t/deploy-filebeat-in-docker-using-a-custom-dockerfile-with-a-entry-script/115530/3 "2018-01-15T16:57:31Z")

</div>

@exekias Thank you ..I have been breaking my head. The second option worked.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [February 12, 2018, 4:58pm UTC](https://discuss.elastic.co/t/deploy-filebeat-in-docker-using-a-custom-dockerfile-with-a-entry-script/115530/4 "2018-02-12T16:58:04Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
