When using Rails inside a Docker container several posts, (including one on docker.com) use the following pattern:
- In
DockerfiledoADD GemfileandADD Gemfile.lock, thenRUN bundle install. - Create a new Rails app with
docker-compose run web rails new.
Since we RUN bundle install to build the image, it seems appropriate to docker-compose build web after updating the Gemfile.
This works insomuch as the gemset will be updated inside the image, but:
The Gemfile.lock on the Docker host will not be updated to reflect the changes to the Gemfile. This is a problem because:
Gemfile.lockshould be in your repository, and:It should be consistent with your current
Gemfile.
So:
How can one update the Gemfile.lock on the host, so it may be checked in to version control?