Mongorestore in a Dockerfile

前端 未结 5 829
借酒劲吻你
借酒劲吻你 2021-02-05 07:10

I want to create a Docker image that starts a mongo server and automatically restores from a previous mongodump on startup.


Here is my Dockerfile for

5条回答
  •  名媛妹妹
    2021-02-05 08:01

    A similar solution to RyanNHG's, but without an sh file.

    Dockerfile

    FROM mongo:3.6.8
    
    COPY dump/ /tmp/dump/
    
    CMD mongod --fork --logpath /var/log/mongodb.log; \
        mongorestore /tmp/dump/; \
        mongod --shutdown; \
        docker-entrypoint.sh mongod
    

提交回复
热议问题