Skip to content
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

Shell provisioning using docker-exec instead of SSH #8145

Open
dbichko opened this issue Dec 21, 2016 · 7 comments
Open

Shell provisioning using docker-exec instead of SSH #8145

dbichko opened this issue Dec 21, 2016 · 7 comments

Comments

@dbichko
Copy link

dbichko commented Dec 21, 2016

As @chrisroberts suggested, I am resubmitting the feature request from #4179, since it wasn't actually addressed by #7377.

Being able to provision containers in the docker provider without an SSH daemon would greatly simplify (and speed up!) configuration, especially for multi-machine setups.

I currently have multiple Dockerfiles that just add sshd to public images from Docker Hub (postgresql, tomcat, nginx, etc); provisioning with exec would allow me to eliminate all the docker build steps, and just use the public images directly.

Ideally, the shell provisioner would prefer exec when using the docker provider (or at least fall back to it when ssh isn't available), but a separate provisioner with "shell-like" functionality would work to.

It seems that #7377 already did the heavy lifting in enabling docker exec support, and allowing the shell provisioner to use it would be quite doable?

Thank you.

@GrzegorzDrozd
Copy link

Hi.
Please do that! I need to use bunch of shell scripts around Vagrant file to use docker-run BUT it would be so much easier to just inline that in Vagrantfile!

Thank you and have a nice day.

@mtekel
Copy link

mtekel commented Jun 13, 2017

Now that vagrant supports running docker directly on MacOS and Win, this would be even more useful. Ability to use any docker image without modification is a strong feature. We would be now able to use all kind of official images, that are not made for Vagrant. And with docker images, it is quite unusual to have sshd built in (...no need for that, when you can docker exec).

@lucasyvas
Copy link

Packer supports this I think. Using SSH is not a good choice as it isn't set up in most Docker images.

@techtonik
Copy link
Contributor

This should be renamed to docker exec as it is standard command now and not some script.

@techtonik
Copy link
Contributor

Warning "Provisioners will not be run since container doesn't support SSH." is output from two places.

  1. action_provision handler:
    I18n.t("docker_provider.messages.provision_no_ssh"),
  2. action_start handler:
    I18n.t("docker_provider.messages.provision_no_ssh"),

@techtonik
Copy link
Contributor

Provisioner, such as shell checks how to execute commands remotely here:

case @machine.config.vm.communicator
when :winrm
provision_winrm(args)
when :winssh
provision_winssh(args)
else
provision_ssh(args)
end

Work with SSH is provided be communicator so before Docker provider can use that, there should be a communicator plugin written with docker exec as ssh replacement. Then it should be set somewhere to appear in machine.config.vm.communicator.

@ProxiBlue
Copy link

Hello:

there should be a communicator plugin written with docker exec as ssh replacement

this now exists:

https://github.com/ProxiBlue/vagrant-communicator-docker

any SSH related commands will be handled using docker API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants