# Update Python files and build Docker container

**URL:** <https://hub.mender.io/t/update-python-files-and-build-docker-container/4267>\
**Category:** General Discussions\
**Tags:** raspberry-pi-3\
**Created:** [November 2, 2021, 3:19pm UTC](https://hub.mender.io/t/update-python-files-and-build-docker-container/4267 "2021-11-02T15:19:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NicoCaldo](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/nicocaldo/32/1409_2.png) [@NicoCaldo](https://hub.mender.io/u/NicoCaldo)\
**Post date:** [November 2, 2021, 3:19pm UTC](https://hub.mender.io/t/update-python-files-and-build-docker-container/4267/1 "2021-11-02T15:19:44Z")

</div>

I’m trying to understand what’s the best way to use Mender to update a Docker image.

Basically, the image is built with a single command line from the terminal and it runs a Python application.

I would like to be able to update the Python source files when needed and rebuild the image (and delete the old container/images and run the new one if possible).

I know that’s that chance to download a new Docker image with the Docker update module on Mender but, it’s not the solution I’m looking for as, I would like to build the image directly on my Rasp

---

<div class="post-metadata">

**Author:** ![oleorhagen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/oleorhagen/32/297_2.png) [@oleorhagen](https://hub.mender.io/u/oleorhagen)\
**Post date:** [November 3, 2021, 8:48am UTC](https://hub.mender.io/t/update-python-files-and-build-docker-container/4267/2 "2021-11-03T08:48:56Z")

</div>

It sounds to me like writing your own [update module](https://docs.mender.io/artifact-creation/create-a-custom-update-module) is the way to go here.

I would highly recommend giving it a try, it’s really pretty straight forward, and gives you great flexibility.

Also, when done, if you think it’s well made, and useful, you can add it to our community contributed update modules, [here](https://hub.mender.io/c/update-modules/13)

😄

Feel free to reach out if you get into trouble.

---

<div class="post-metadata">

**Author:** ![NicoCaldo](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/nicocaldo/32/1409_2.png) [@NicoCaldo](https://hub.mender.io/u/NicoCaldo)\
**Post date:** [November 3, 2021, 10:17am UTC](https://hub.mender.io/t/update-python-files-and-build-docker-container/4267/3 "2021-11-03T10:17:02Z")

</div>

As soon as all the operations I need can be performed with a script (basically all the operations are commands on the console) I should be able to use the [Script - Update Module](https://hub.mender.io/t/script/328), shouldn’t I?

---

<div class="post-metadata">

**Author:** ![oleorhagen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/oleorhagen/32/297_2.png) [@oleorhagen](https://hub.mender.io/u/oleorhagen)\
**Post date:** [November 3, 2021, 4:21pm UTC](https://hub.mender.io/t/update-python-files-and-build-docker-container/4267/4 "2021-11-03T16:21:07Z")

</div>

You can 🙂

Most definitely possible.
