sous-chefs / docker

Development repository for the docker cookbook
https://supermarket.chef.io/cookbooks/docker
Apache License 2.0
1.36k stars 794 forks source link

Changing log options doesn't restart container #985

Open spuder opened 6 years ago

spuder commented 6 years ago

Cookbook version

4.1.1

Chef-client version

Chef 12.18.31

Platform Details

Ubuntu 16.04

Scenario:

If you change the 'logging' options it does not reconfigure / restart the container

Steps to Reproduce:

  1. Create a docker container
docker_container 'nginx' do
  action :run
end

Then change the log_driver or log_opts

docker_container 'nginx' do
  log_driver 'splunk'
  log_opts ['splunk-url=foobar.splunk.com:8088', 'splunk-token=123457890', 'splunk-source=docker', 'splunk-sourcetype=foobar']
  action :run
end

Then run chef. Then run a docker inspect, you will find the 'splunk' logger isn't there

docker inspect nginx | grep splunk

Workaround

Deleting and recreating the container by hand fixes the issue

docker stop nginx
docker rm nginx
chef-client

Looking at docker inspect shows the splunk options now

docker inspect nginx | grep splunk
            "LogConfig": {
                "Type": "splunk",
                "Config": {
                    "splunk-format": "json",
                    "splunk-source": "docker",
                    "splunk-token": "xxxxxxxx",
                    "splunk-url": "https://foobar.example.com:8088"
                }
            },

Expected Result:

Chef should restart the container just like it does if you change any other options (e,g, volumes, labels, tags)

Actual Result:

Chef does not restart or reconfigure the container on any logging changes

ziprick commented 6 years ago

Confirmed issue to still be present, exactly as described above, as of July 2018

docker cookbook version: 4.4.0 platform: Ubuntu 16.04 chef-client: 14.3.37

timorkal commented 4 years ago

Somebody is going to solve it? this is an issue from 2018...

manuelmazzuola commented 1 year ago

Any updates?