BUG: On Ubuntu 18.04 vagrant-proxyconf 2.0.1 when docker-ce-cli is installed it tries to configure systemd even though the docker daemon service is not there.
codylane opened this issue · 8 comments
OS: Ubuntu 18.04 amd64
Vagrant version: 2.2.4
vagrant-proxyconf version: 2.0.1
How to reproduce:
When following this guide: https://docs.docker.com/install/linux/docker-ce/ubuntu/
And only installing docker-ce-cli
on the host, and then running vagrant provision
the vagrant-proxyconf plugin will attempt to configure the docker systemd service.
With the following error:
$ vagrant provision
==> default: Configuring proxy for Apt...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
sed -e 's/\[Service\]/[Service]\nEnvironmentFile=-\/etc\/default\/docker/g' /lib/systemd/system/docker.service > /tmp/docker.service
Stdout from the command:
Stderr from the command:
sed: can't read /lib/systemd/system/docker.service: No such file or directory
vagrant@devenv:~$ dpkg -l | grep -i docker
ii docker-ce-cli 5:18.09.5~3-0~ubuntu-bionic amd64 Docker CLI: the open-source application container engine
Potential solution:
- - Check to see if the systemd file exists before trying to configure it.
Interesting, I didn't notice this before but it looks as though this plugin attempted to support configuring the docker daemon with proxy configuration but it was done so in the cap
directories.
The cap directories have a few additional flaws that need to be addressed and need to be cleaned up.
If 2.0.2, addresses the docker daemon setup, then I feel like it's also a good idea to remove whatever implementation exists in the cap
implementations. The bug we are seeing above is caused by the capability file thinking systemd is working but that's not always the case especially if you are inside a docker container or the system doesn't have the full systemd integration installed.
Places where this is defined in the capabilities
Looks like you may already be fixing this but, just in case it is useful, this also happened to me when I installed the Docker snap package in the vagrant machine manually and then I did a vagrant halt
and a vagrant up
later. Looks like it is because the snap installs Docker differently than apt and doesn't have the same systemd files created.
Hi @zicklag - Thank you for the report and for notifying us that this behavior also affects other types of docker installs. This does seem to be one of those edge cases that will be challenging to fix.
Due to time constraints and how this code base is currently architected I'd say we probably won't be trying to support every type of docker-ce install and will probably only support the package manager install (in this case apt
) instead of snap.
I'm still attempting to solve this issue, although I see this one as a minor compared to other bugs/features that need to be addressed. I do appreciate you taking the time to help report this issue and it is validating to know that others are also experiencing this problem.
If you feel that this issue issues needs faster resolution and if others feel the same way, please help me prioritize this by thumbs upping this message. Otherwise, if you feel comfortable and have some free time and willing to help we will accept pull requests.
I don't have a large need for it and I think it is reasonable that you would not be able to universally set the Docker proxy for every installation method. If you can't manage to fix it, no big deal. We would just want to log that the Docker proxy could not be set so that the user knows what is happening and can respond accordingly.
I don't have a large need for it and I think it is reasonable that you would not be able to universally set the Docker proxy for every installation method. If you can't manage to fix it, no big deal. We would just want to log that the Docker proxy could not be set so that the user knows what is happening and can respond accordingly.
Just curious, would you be able to share a gist or paste in the errors/issues that you are seeing in code block here in this thread? I'd love to have that for my own reference just to make sure I'm seeing the same error or if it's a little different.
I agree, I want to squelch un-handled exceptions as best as I can with more helpful error messages. Hopefully, this will be an easy fix which I hope to have some free time next week.
Thanks again and looking forward to hearing from you. Also hope your week is going well.
I'm pretty sure that it was exactly the same, but I'll try it again when I get the chance to make sure.
Here is the error I get:
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
sed -e 's/\[Service\]/[Service]\nEnvironmentFile=-\/etc\/default\/docker/g' /lib/systemd/system/docker.service > /tmp/docker.service
Stdout from the command:
Stderr from the command:
sed: can't read /lib/systemd/system/docker.service: No such file or directory