garethr / garethr-docker

Puppet module for managing docker
Apache License 2.0
397 stars 528 forks source link

Docker compose resources are not refreshed #553

Open svenmueller opened 8 years ago

svenmueller commented 8 years ago

Hi,

Changes are not applied to Docker Compose resources when using notify/subscribe meta-parameter. Any idea how to achieve that?

E.g. when the file /tmp/docker-compose.yml changes, the docker containers are not refreshed/restarted:

  file { '/tmp/docker-compose.yml':
    content => template('prometheus/docker-compose.yml.erb'),
    owner   => root,
    group   => root,
    mode    => '0640',
    notify  => Docker_Compose['/tmp/docker-compose.yml'],
  }

  docker_compose { '/tmp/docker-compose.yml':
    ensure  => present,
    require => Class['Docker::Compose'],
  }
garethr commented 8 years ago

As of this PR https://github.com/garethr/garethr-docker/pull/550 I think this should now be possible. Could you check from master (although this should also be in 5.3.0).

AblionGE commented 8 years ago

@garethr Nice PR but I still have one issue with it: the refresh will kill containers and restart them. In my case I don't want this behavior (a simple docker-compose up -d --remove-orphans fits my needs).

In fact, the problem is that before, in every puppet run, the docker-compose up was executed (thus, with the --remove-orphans option, removed services were destroyed during the puppet run) and since a few days it doesn't anymore (I don't know if it comes from the v5.3.0 or from some modifications on my side).

Do you have an idea how to have docker-compose up running on each puppet run? The best solution seems to be to improve the refreshing feature with a boolean parameter to select if the containers have to be killed before the up command.