How to persist data in a dockerized postgres database using volumes

后端 未结 4 667
伪装坚强ぢ
伪装坚强ぢ 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:46

    I think you just need to create your volume outside docker first with a docker create -v /location --name and then reuse it.

    And by the time I used to use docker a lot, it wasn't possible to use a static docker volume with dockerfile definition so my suggestion is to try the command line (eventually with a script ) .

提交回复
热议问题