Enabling remediation
Enabling remediation plans and pull requests on Docker
Enable remediation plans and pull requests for Compose services and containers started with docker run.
Complete the shared preparation in Enabling remediation plans first.
If you only want to check candidates for published images without configuring mappings, merge the following minimal configuration into the host's config.yml.
Proceed to Verifying remediation plans.
If you configure mappings, use the section matching how the monitored containers are started, then verify remediation plans and enable pull requests.
Edit the host's config.yml in the KestreLynx deployment directory.
The file created in Prepare the configuration is mounted at /etc/kestrelynx/config.yml inside the container.
See Terms for the terminology used on this page.
Mapping Compose services
Map Compose services to the files to update in a GitHub repository.
Identifying the workload key
Identify the workload key for the mapping from the running container's Compose labels.
- Replace
<container-name>with the target running container's name and rundocker inspect <container-name> - Note the values of the
com.docker.compose.projectandcom.docker.compose.servicelabels - Use the label values to construct the workload key
compose/<project>/<service>
If the target container's project is example and its service is web, the service's workload key is compose/example/web.
The Compose project name can differ from the repository or directory name, so use the label value from the running container.
Configuring the mapping
Specify the file to update using the configuration keys selected in the shared source mapping instructions.
- Replace the workload key, GitHub repository, branch, target file, and service name in the example below with their actual values
-
Merge the following configuration into
remediationin the host'sconfig.ymlThis example is for updating an image tag in a Compose file.
remediation: enabled: true mappings: - workload: compose/example/web repository: example/deployment base_branch: main compose: path: compose.yml service: webThis example updates the Dockerfile and dependency files of an application you build and run with Compose. Instead of the image tag example, merge the following configuration into
remediationin the host'sconfig.yml.
See Compose settings for configuration keys and constraints on multiple mappings, and basic settings for the enablement keys.
Mapping docker run containers
In Docker mode, map containers started without Compose by their names. For published images, KestreLynx does not create PRs that change the image tag used to start the container.
To update a Dockerfile or dependency files on GitHub, follow these steps.
- Run
docker ps --format '{{.Names}}'to check the running container's name assigned withdocker run --name -
Replace the example values below with actual values and merge the configuration into
remediationin the host'sconfig.ymlThis example maps the Dockerfile and dependency directory for
example-apiin one entry.remediation: enabled: true mappings: - workload: container/example-api repository: example/application base_branch: main dockerfile: path: Dockerfile dependencies: directory: .If the repositories or branches differ, use separate entries with the same
workload. See the shared source mapping instructions for preparing dependency directories and docker run settings for name and configuration constraints.
When recreating a container for the same application, specify the same name with docker run --name.
KestreLynx does not verify that the container was built from the specified repository, so do not reuse its name for another application.
Reusing a name can cause PRs based on another application's findings to be created in the repository still named in the configuration. See docker run containers for when containers are included and image store limitations.
Verifying remediation plans
Apply the configuration and verify that remediation plans are enabled and have processed the targets.
The following commands use the configuration from the setup guide; run them in the directory containing the host's config.yml.
-
Recreate the container using the commands for how KestreLynx itself is started
-
If started with Compose, run the following
-
If started with
docker run, run the followingdocker stop kestrelynx docker rm kestrelynx docker run -d --name kestrelynx \ --restart unless-stopped \ -e TZ=UTC \ -v /var/run/docker.sock:/var/run/docker.sock:ro \ -v "$PWD/config.yml:/etc/kestrelynx/config.yml:ro" \ -v kestrelynx-state:/var/lib/kestrelynx \ ghcr.io/kitsunetrail/kestrelynx:latest
If you customized the startup options, retain those values and do not delete the
kestrelynx-statevolume. -
-
Run
docker compose logs -f kestrelynxfor Compose, ordocker logs -f kestrelynxfordocker run - In the startup log
fix plan enabled, verify thatmappingsequals the configured number of mappings and thatpull_requests=false -
In the scan after startup or at the next scheduled time, check for
scanned imagefor the target image andfix plan builtfor the remediation planZero values for the candidate counts
update_candidate,dependency_update_candidates, anddockerfile_update_candidatesdo not mean that plans are disabled. -
When a notification arrives, check that the workload, source, and update target are as intended using the displayed fields
If startup fails, check the error message in the log and the remediation plan and pull request settings. If you cannot find a plan, follow checking for a missing plan.
Enabling remediation pull requests
After verifying plans and reviewing the shared PR creation prerequisites and precautions, enable remediation pull request creation using the following steps.
-
In the host's
config.yml, set the following values underremediation, retaining the existing mappings, credentials, and storage location -
In the directory containing the host's
config.yml, recreate the container using the same commands as step 1 of Verifying remediation plans -
Run
docker compose logs -f kestrelynxfor Compose, ordocker logs -f kestrelynxfordocker run, and check thatfix plan enabledincludespull_requests=true -
In the next cycle’s notification, check the “Pull request” and “Update” lines against Displayed fields to verify the PR status and update contents
For npm, pnpm, pip, uv, Go, Gradle, and Rust updates, KestreLynx uses the Docker API to create, start, and remove work containers. Maven updates do not use work containers.
The Docker socket's :ro mount does not restrict API operations, so the supplied Compose configuration does not need to change to :rw.
If you use a Docker API proxy, allow work container creation, startup, and removal. If no PR is created, see checking for a missing PR.