garethr-docker
garethr-docker copied to clipboard
Support purge for Docker::Run
Feature request:
It would be nice if we had the option (in the main class configurations) to allow for purging of unmanaged containers and services
Right now if we remove a 'docker run' from the code, the container just keeps living in the machine forever
There is (undocumented though) option to delete the container after running for docker::run
here https://github.com/garethr/garethr-docker/blob/master/manifests/run.pp#L107 .
@gdubicki issue is with the service files installed under systemd/init. If you remove a docker::run, those files are still in the system, and so the init system keeps bringing the containers up
Oh, ok. Then there is another undocumented :), but standard, parameter - ensure
- which you can use to delete the service. See the code: https://github.com/garethr/garethr-docker/blob/master/manifests/run.pp#L306
Example:
docker::run { 'helloworld':
ensure => absent,
image => 'base',
command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"',
}