Open
Description
Describe the Bug
If a docker network exists with the same name as the container created by docker::run
, the following error results:
Error: Failed to apply catalog: undefined method `[]' for nil:NilClass
/opt/puppetlabs/puppet/cache/lib/puppet/functions/docker_params_changed.rb:86:in `detect_changes'
Expected Behavior
docker::run
should work
Steps to Reproduce
Apply
docker_network{'prometheus':
driver => 'bridge',
}
docker::run{'prometheus':
image => 'prom/prometheus',
ports => '9090:9090',
restart => 'always',
net => 'prometheus',
}
Environment
- Version 10.2.0
- Platform Ubuntu 24.04, Puppet 8.10.0
Workaround
- Rename network or container
- Remove network manually
- Re-apply catalog
Additional Context
The issue seems to be that docker_params_changed.rb
runs docker inspect
and doesn't check whether it's getting results for the right thing.
param_changed = true if opts['image'] && opts['image'] != inspect_hash['Config']['Image']
^ For the network, there is no Image key.
Even if this doesn't need to get fixed, finding this on a search may help someone not waste time.