This feature provides per-cluster persistent bash history, allowing you to maintain separate command histories for each cluster you work with.
This feature is opt-in and is disabled by default.
The following config options are provided for the persistent-histories functionality:
features:
persistent_histories:
# Enable or disable persistent histories
# Default: false, must be explicitly enabled
enabled: true
# Path to the storage directory where cluster histories will be saved
# Defaults to '.config/ocm-container/per-cluster-persistent'
# Can be either an absolute path or relative to $HOME
# This directory must be created manually for this functionality to work
storage_dir: .config/ocm-container/per-cluster-persistentIf using the default storage directory, you may need to mkdir -p ~/.config/ocm-container/per-cluster-persistent for this functionality to work.
When enabled and a cluster-id is provided:
- ocm-container resolves the cluster ID from OCM using the provided cluster identifier (name, ID, or external ID)
- Creates a subdirectory named after the cluster ID
- Mounts this directory at
/root/.cluster-historyinside the container with read-write permissions - Sets the
HISTFILEenvironment variable to/root/.cluster-history/.bash_history
This ensures that each cluster maintains its own independent bash history that persists across container sessions.
The storage directory is resolved in the following order:
- Absolute path: If
storage_diris an absolute path (e.g.,/home/user/cluster-histories), it will be used directly - HOME-relative path: If
storage_diris a relative path (e.g.,.config/ocm-container/per-cluster-persistent), it will be resolved relative to$HOME
The directory structure will look like:
$HOME/.config/ocm-container/per-cluster-persistent/
├── 1a2b3c4d5e6f7g8h9i0j/
│ └── .bash_history
├── 9i8h7g6f5e4d3c2b1a0/
│ └── .bash_history
└── ...
- The feature must be explicitly enabled in the configuration
- A cluster-id must be provided via the
--cluster-idflag - The storage directory must be accessible
- If the storage directory cannot be found, the container will exit with an error
- Each cluster's history is isolated from other clusters
- The history files persist across container sessions, allowing you to maintain context for each cluster
- If no cluster-id is provided, the history will not be kept