Skip to content

Further customizing Docker

Mike Solin edited this page Jan 24, 2024 · 5 revisions

Overriding files in the Docker image

Sometimes, you might need to override files that are present in the Docker image. You can do this by adding a volume that overrides a specific file or directory that's present in the Docker image.

In the example instructions, you created a volume like this:

        volumes:
            - /data/docker/munkireport/local:/var/munkireport/local:rw

To override a directory (or file!), you'd just provide your own replacement. For example:

        volumes:
            - /data/docker/munkireport/local:/var/munkireport/local:rw
            - /data/docker/munkireport/README.md:/var/munkireport/README.md:ro

In the above, you'd provide your own README.md file, and that would replace the one that's in the Docker image.

Customizing PHP

Please note: this is untested at the moment!

(Instructions mostly lifted from this Stack Overflow answer)

In other setups, you might be familiar with editing the php.ini file to increase the upload size, etc. With Docker, you can do that too, but it's slightly different. Instead of customizing your own php.ini file and overriding it (using the above instructions), it's recommended that you create a new file with your customizations, and link it as a volume:

        volumes:
            - /data/docker/munkireport/local:/var/munkireport/local:rw
            - /data/docker/munkireport/php_custom.ini:/usr/local/etc/php/conf.d/php_custom.ini:ro

You can use PHP's official documentation to determine what you can override. After creating and populating your file, restart your container:

/usr/bin/docker restart munkireport

Adding custom modules

When using Docker, adding custom modules is done slightly differently. This guide will assume you followed the demo setup, so if you changed anything from that guide, you'll need to make some modifications here.

First, you'll want to find the module you want to add. See this list elsewhere on the wiki for examples of modules you can install.

Next, you'll want to visit that module's "releases" page and download the zip file for the latest version. Unzip it, and copy the entire folder to /data/docker/munkireport/local/modules (create the modules directory if it doesn't already exist). If there's a version number at the end, rename it to just the module's name. For example, change bees-1.0 to just bees.

In your munkireport.env file, add the name of the module to the MODULES list. Save the file.

Run /data/scripts/update_docker_containers.sh to rebuild the container (since you changed the env file). This will enable the module that you uploaded.

Once your MunkiReport container has been recreated, you'll need to run the migrations for the module to create the database tables specific to this module. Click Admin > Upgrade Database, then click the Update button.

Finally, you'll probably need to create a new client package (since the module you installed probably contains a client script). You can find instructions on how to do that here. Be sure to specify a higher version than the one you're already deploying, so Munki installs it on your fleet!

Updating included modules

Some modules are included in the Docker image, which helps when you're just getting started. However, the Docker image isn't updated frequently, but the modules are!

If you want to run a newer version of a module that's included in the immutable Docker image, just follow the same process as outlined in the "Adding custom modules" section above. Your custom modules path will override the one included in the Docker image. Be sure to run migrations and build a new client pkg.

Clone this wiki locally