Want to make storage of docker persistent ?

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.

wordpress and mysql storage

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).

YAML file for wordpress and mysql.

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 .

docker infrastructure.
docker containers.

You can login to this wordpress site with IP and port stored in compose file.

Here used to login wordpress.

wordpress on docker.

If you want to login to Mysql database use credentials stored in  compose file.

mysql on docker

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.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s