0

I've setup the following service in my docker-compose.yml file:

version: "3.3"

services:
  test:
    build: .
    command: bundle exec guard --no-bundler-warning --no-interactions
    tty: true
    volumes: *volumes
    environment:
      DATABASE_URL: mysql2://root:root@database:3306/my-rails-app
      DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: 1
      RAILS_ENV: test
    depends_on:
      - database

But it's not working properly - when I use docker-compose up, it's going to create the container and run the tests, but the watch won't be triggered when I change a file in my host. Does anyone know why? The config seems pretty ok to me.

  • which bit is the 'watch'? i am not so sure what you are expecting it to do can you explain? – simbo1905 Jan 27 at 6:44
  • my suspicion is that you are expecting this to behave like it would on your local machine that has a 'history' of previous build. so you build tools can recognise changes to state. the amazingly useful thing about docker is that the file system on the container is reset every time it is started. it has no history of previous changes. you cannot do incremental builds as it would be the first build every time. then again i am not really sure what the command is or what you are expecting it to do. – simbo1905 Jan 27 at 6:54
  • there is a docker based build tool s2i that does do incremental builds; it pushes the last build state as a new layer into the docker registry. when it starts the next build it pull the layer of the last build. this means it can cache allthe libraries it downloaded saving a huge amount of time and stopping the build failing due to the downlaod of dependencies having a network glitch. – simbo1905 Jan 27 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.