Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to persist the settings? #4

Open
zjffdu opened this issue Nov 19, 2024 · 1 comment
Open

Any way to persist the settings? #4

zjffdu opened this issue Nov 19, 2024 · 1 comment

Comments

@zjffdu
Copy link

zjffdu commented Nov 19, 2024

Every time when I restart the docker container, I have to reset all the settings, specially for the node label.
It would be better to persist the setting somewhere and load it when the container is started.

@amansharif
Copy link

If I understand your problem correctly, you want to persist container settings, such as node labels, across restarts and I suppose it's a common Docker level problem statement. Docker’s volume mount feature is a great way to achieve this. By using volumes, you can store configuration files or settings on your local filesystem and mount them inside the container. This ensures that changes persist even after restarting the container.

Here’s how you can do it:

  1. Identify the file or location where the settings (e.g., node labels) are stored in your container.
  2. Create a corresponding file or directory on your host system to hold these settings. For example:
    mkdir -p ~/docker-settings
  3. Use Docker's -v or --mount option to bind this directory to the appropriate location inside your container. For example:
    docker run -v ~/docker-settings:/path/to/settings your-image
    Replace /path/to/settings with the path inside the container where the configuration file is stored.

Now, any changes made to the settings will persist in the ~/docker-settings directory on your host system, even if the container is restarted.

If the settings are stored in the container's environment variables rather than a file, you might consider using a .env file to persist and reapply them when restarting the container.

By implementing this, you can ensure that your node labels and other settings are retained across container restarts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants