-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker 20.10 doesn't let the module work. #689
Comments
Puppet does not set $HOME; line 41 in puppetlabs-docker/lib/puppet/provider/docker_network/ruby.rb: |
Also seeing this same error on Centos7 with Docker version 19.03.13, build 4484c46d9d |
Same problem on Debian 10 with Docker version 20.10.0, build 7287ab3 |
Same problem for docker volumes provider. V19:
V20:
|
@sebastianTC great you posted the difference between output here, and from what I can see in puppetlabs-docker/lib/puppet/provider/docker_network/ruby.rb line 52 the amount of used spaces is not a problem. The problem is related to the warning line being parsed as well, which can be seen in the output provided from @sdinten . So the actual header row is currently parsed as network entry, and the second value in that row is "ID", which explains the current behaviour. Best solution: Workaround: |
Maybe it would be better/easier to use -q option on docker ls commands which is only giving back the names as a list without any header. This doenst help in this specific problem but would avoid issues with future changing formatting. |
The module currently makes use of the network name and driver, both would be missing from this view. Not sure if there are additional parameters? I implemented a local workaround to ignore the Warning in the output for the docker network ls, which seems to work, but then there is just another similar error related to missing $HOME:
So I don't think the workaround is viable. To fix the missing HOME: |
The script could get the IDs from the first command directly without removing the header and spliting the lines.
I think docker command is defined in line 9: I cannot test it now but
|
It appears that the Network ID is always a hexadecimal string. Instead of blindly dropping the first line from the output, it might be better to loop through all of the output and use a regex match to skip any lines that don't have a hexadecimal string in the first column. I'm not sure of the correct ruby code but something like
|
My workaround looked like this, and worked fine, but there are more similar calls to docker where the given warning appears and would have to be fixed in multiple locations:
This workaround will allow the fact collection to finish, but it will error in the configuration application stage in similar form:
I still think we should focus on actually fixing the missing HOME in the docker cli call, but I am also not a ruby expert. |
Does anyone have an update on this bug. I updated to version 20.10 got the error then tried several versions of puppetlabs docker and lower versions of Docker and still getting the error. Any ideas? |
@gerbdla I have had a quick look at the suggestion made by @cjbnc (good suggestion btw.) but haven't got time to look into this further for now. Hope to spend some time on it this Sunday I ran into the same issue after downgrading docker-ce and found that I had to downgrade docker-ce-cli as well, currently running 5:19.03.12 |
we used this tempfix for the moment. It works on CentOS. It is not great but better than having puppet blocked.
|
Created a pull request: #692 Also moved to 20.10 on my debian 10 box and added the main branch of /~https://github.com/sdinten/puppetlabs-docker to my Puppetfile. Puppet runs now run without issues with Docker-ce 20.10 on Debian 10 (including creating new networks if required) |
fixing issue #689 by setting HOME in docker command
@sebastianTC I agree, I did not think about this (obviously :)). My PR has already been merged so I cannot update it. Can you make a new PR for this? (maybe we should raise a new issue for this as well?) |
Hmm, the puppet agent is (usually) run as root, so the sensible setting for HOME would be /root, or am I wrong? Would it be possible to detect the home directory of the executing user? Also, docker doesn't complain if the HOME directory does not exist, so setting HOME to a not existing path would solve the problem as well:
I also played around with changing the docker log level up to error or fatal ( |
I think you could also get the name and driver with the --format command. It solves the parsing other than the WARNING problem.
|
Looks like it's fixed in the 3.13.0 release. Thanks! |
Has there been a regression or was this not fixed for
|
A quick scan in the docker::run class shows that "it should" set the HOME variable to '/root' when not running on windows. Can you elaborate on the error message and post the versions you use? puppetlabs-docker/manifests/run.pp Line 367 in 4a4e29a
|
This is on Ubuntu 20.04 and we're using v4.0.0 of the module. The snippet you posted only covers the Exec resources. The Deferred function doesn't run
|
@cedws I tried to reproduce the issue but no luck so far. Can you share your configuration maybe? Steps taken:
|
@sdinten Cheers for looking into this. Could it be because the shell you're running
|
'unset HOME; puppet apply -t test.pp` gives the same result on my end. The docker::run class creates a systemd service, stop and start scripts and starts the container as expected. A thing I noticed is that you use docker.io for ubuntu 18.04, in order to be able to use that I had to change my puppet code to stop managing the package (still my sample code works when using the docker.io package instead of the docker-ce package)
Can you create a debug log file of the failing puppet run (e.g. Also, if the systemd service is actually created, can you share the output of `systemctl status docker-'? |
Sorry, sharing logs is tough because I need to censor things from our production environment. But I think I can give you some steps to reproduce the stderr output from Docker. What happens if you do this:
What I would expect you to see is this, with the first line being the problem.
|
I am able to reproduce the |
Right, I've done a bit more investigation starting from scratch. Try this resource declaration: docker::run { 'helloworld':
image => 'ubuntu:precise',
command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"',
restart => 'always',
} For some reason
|
Edit: That was nonsense, I was running Puppet with |
Got to reproduce the error, see below for the output. Running this with $HOME set gives the same result except for the warning message with To summarize, when adding
I'll look into this once the kids are sleeping (8 pm "ish" CET) ;)
|
@cedws I think I have found why this is not working for you. I agree that in your setup the error message ( Looking at the documentation; https://forge.puppet.com/modules/puppetlabs/docker (search for 'run includes a number of optional parameters'). The puppetlabs-docker/manifests/run.pp Line 10 in 998d11d
extra_parameters to define the restart policy.
Further down in the if statement where puppetlabs-docker/manifests/run.pp Line 455 in 998d11d
It would have helped to have more clear error messaging, maybe you can raise a separate issue for this. Using the below definition (both with and without $HOME set) the resources are created/changed correctly, removal works as well when adding
|
Hey @sdinten, apologies for the delayed response. Indeed, removing The omission in the docs you mention could be a mistake I think. On that same page is a snippet which shows docker::run { 'helloworld':
image => 'microsoft/nanoserver',
command => 'ping 127.0.0.1 -t',
restart => 'always' Thanks again. |
@cedws good point I think we could have a discussion forever about this being a bug or not ;). Based on:
My conclusion would be that this has to be implemented in the code and the documentation has to be made consistent about the availability of this parameter. As it is not related to this topic (Docker 20.10 doesn't let the module work) I will attempt to do this through #694. |
This issue has been marked as stale because it has been open for a while and has had no recent activity. If this issue is still important to you please drop a comment below and we will add this to our backlog to complete. Otherwise, it will be closed in 7 days. |
Describe the Bug
With docker 20.10 the module (3.11.0) fails. In particular this step fails: /~https://github.com/puppetlabs/puppetlabs-docker/blob/v3.12.1/lib/puppet/provider/docker_network/ruby.rb#L41-L46
Expected Behavior
That it works like with docker 19.03
Steps to Reproduce
Environment
Additional Context
Docker 20.10 was installed on some of our machines yesterday 2020-12-09 and we noticed the problem popping out.
The text was updated successfully, but these errors were encountered: