If you want to make the data of your docker persistent we need to follow these steps. Here my wordpress and mysql database is running on docker.
Step 1: Create volume(storage) for wordpress and mysql.
I have created wp_storage and mysql_storage .
Step 2: Create docker compose file.
Follow the steps below to create docker-compose.yml . It is necessary to create with this name and format (YAML).
Now my whole infrastructure is setup in this file.
As soon as you write # docker-compose up command whole infra will be launced in one click .
You can login to this wordpress site with IP and port stored in compose file.
Here 192.168.99.101:8091 used to login wordpress.
If you want to login to Mysql database use credentials stored in compose file.
Here my whole setup has persistent storage as we have mounted volumes (in base O.S) to their path.
** We can use following commands to the compose file.
#docker-compose up ( to run )
#docker-compose stop ( to stop )
#docker-compose start ( start again )
#docker-compose up -d ( to run in background )**
If you have any queries post it on the comments section below.