cancel
Showing results for 
Search instead for 
Did you mean: 
khokha
Flight Engineer
Flight Engineer
  • 1,790 Views

Hello everyone,

I've urgent question about containers, how i make my configurations permanent and survive reboot?

starting from creating containers and being in running state and everything. 

Thanks

1 Solution

Accepted Solutions
5 Replies
Wasim_Raja
Moderator
Moderator
  • 1,759 Views
khokha
Flight Engineer
Flight Engineer
  • 1,754 Views
Thank you
Chetan_Tiwary_
Community Manager
Community Manager
  • 1,735 Views

Hello @khokha !

Making your container configurations permanent and survive reboot can be achieved via several procedures , some of them ( but not limited to ) are as follows :

1. Use persistent volume : A persistent volume is a block of storage that is not tied to any particular container. This means that if you create a container that uses a persistent volume, the data in that container will survive even if the container is stopped or restarted.

2. Mount the data or configuration files : use the -v or --volume flag when running the podman run command. This will avoid the hard coding of your configuration files inside your container , because you can change it externally and mount it using -v. This will persist after rboot also. 

3. Environment variables : use -e while running podman run command to pass environment variables : eg.  -e MYSQL_USERNAME -e MYSQL_PASSWORD etc.

4. Ansible : using it define your desired state and it will automatically apply when the container starts. 

5.  Integrating Podman with systemd : This allows for setting up containers or pods as systemd services. This works like  creating a basic user as a "service user" for the application with systemd , then, the user is given the ability to start a service at system start that persists even after the last user session closes. Use the loginctl command to configure the systemd user service to persist after the last user session of the configured service closes. 

khokha
Flight Engineer
Flight Engineer
  • 1,727 Views

what is the difference between the persistent volume and the mount data? aren't they the same we use -v option to data persistent?

Chetan_Tiwary_
Community Manager
Community Manager
  • 1,725 Views

Persistent volume is a block of storage that is not tied to any particular container i.e data in that container will survive even if the container is stopped or restarted. 

Mount data using the -v option allows you to bind directories between the host machine and the container, making data available and persistent. It allows you to mount data volumes or directories from the host machine into the container.

Join the discussion
You must log in to join this conversation.