How to deal with persistent storage (e.g. databases) in Docker

前端 未结 14 1305
野的像风
野的像风 2020-11-22 11:54

How do people deal with persistent storage for your Docker containers?

I am currently using this approach: build the image, e.g. for PostgreSQL, and then start the c

14条回答
  •  庸人自扰
    2020-11-22 12:09

    When using Docker Compose, simply attach a named volume, for example:

    version: '2'
    services:
      db:
        image: mysql:5.6
        volumes:
          - db_data:/var/lib/mysql:rw
        environment:
          MYSQL_ROOT_PASSWORD: root
    volumes:
      db_data:
    

提交回复
热议问题