Running migrations with Rails in a Docker container with multiple container instances

前端 未结 2 1691
时光取名叫无心
时光取名叫无心 2021-01-31 09:01

I\'ve seen lots of examples of making Docker containers for Rails applications. Typically they run a rails server and have a CMD that runs migrations/setup then brings up the Ra

2条回答
  •  情深已故
    2021-01-31 09:43

    docker run  rake db:migrate
    

    Starts you standard application container but don't run the CMD (rails server), but rake db:migrate

    UPDATE: Suggested by Roman, the command would now be:

    docker exec  rake db:migrate
    

提交回复
热议问题