How to persist data in a dockerized postgres database using volumes

后端 未结 4 670
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 01:32

My docker compose file has three containers, web, nginx, and postgres. Postgres looks like this:

postgres:
  container_name: postgres
  restart: always
  ima         


        
4条回答
  •  时光说笑
    2020-11-28 01:50

    I would avoid using a relative path. Remember that docker is a daemon/client relationship.

    When you are executing the compose, it's essentially just breaking down into various docker client commands, which are then passed to the daemon. That ./database is then relative to the daemon, not the client.

    Now, the docker dev team has some back and forth on this issue, but the bottom line is it can have some unexpected results.

    In short, don't use a relative path, use an absolute path.

提交回复
热议问题