I created a postgresql docker with my server, and when it is time to put some data into it, I realized the standard path of /var/lib/postgresql/data in my ubuntu does not have postgresql/data.
I remembered my database name, host, username, password, & port. I just don’t know where is the database’s path to point at. There wasn’t any noticeable error when I run the compose.
If I’m asked to fill in the “database” part, am I suppose to include this front part ./data/postgres: too, because how do I see it in my Ubuntu’s Shell?
Important Note: Mount the data volume at /var/lib/postgresql/data and not at /var/lib/postgresql because mounts at the latter path WILL NOT PERSIST database data when the container is re-created.
I don’t understand it. What do you mean exactly? What standard path are you referring to on your Ubuntu? /var/lib/postgresql/data is in the container. ./postgresql/data should be on your host. It is a relative path so the exact path depends on where your project is.
You mean “database path”? Or what is the “database part”?
The string on the left side of the colon is the source path. The string on the right side is the path in the container.
You mount local postgres folder directly into data inside the container, so you will probably not see another data folder on the host. But the data content will be in your local postgres folder.
If that is your problem, then to make it more clear in the future, you could use: