# Configure your docker with ansible without ssh

**URL:** <https://forum.ansible.com/t/configure-your-docker-with-ansible-without-ssh/16624>\
**Category:** Ansible Developer\
**Created:** [October 28, 2014, 4:51pm UTC](https://forum.ansible.com/t/configure-your-docker-with-ansible-without-ssh/16624 "2014-10-28T16:51:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Bitard](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@Michael\_Bitard](https://forum.ansible.com/u/Michael_Bitard)\
**Post date:** [October 28, 2014, 4:51pm UTC](https://forum.ansible.com/t/configure-your-docker-with-ansible-without-ssh/16624/1 "2014-10-28T16:51:11Z")

</div>

Hi,

I used a lot ansible\_connection=chroot to configure a chroot on some of my hosts and I think this would be a nice feature if we were capable of launching an ansible playbook to configure a docker, but from the host machine and without ssh (ansible\_connection=docker ?).

I use ansible to orchestrate the docker deployment and sometimes to configure docker containers, but it’s a pain to have to setup ssh in my docker container, and it’s a bad practice : [http://jpetazzo.github.io/2014/06/23/docker-ssh-considered-evil/](http://jpetazzo.github.io/2014/06/23/docker-ssh-considered-evil/)

What do you think?

Regards,  
Michaël

---

<div class="post-metadata">

**Author:** ![Greg\_DeKoenigsberg1](https://avatars.discourse-cdn.com/v4/letter/g/838e76/32.png) [@Greg\_DeKoenigsberg1](https://forum.ansible.com/u/Greg_DeKoenigsberg1)\
**Post date:** [October 28, 2014, 5:03pm UTC](https://forum.ansible.com/t/configure-your-docker-with-ansible-without-ssh/16624/2 "2014-10-28T17:03:49Z")

</div>

Not a comment about the proposed functionality itself -- I'll leave  
that to the experienced developers.

I do, however, feel that the assertion "docker ssh considered evil"  
should be challenged.

It's interesting how many opinions there are about Docker best  
practices -- and how comparatively few of them come directly from the  
nice folks at Docker.

Here's a direct quote from Solomon Hykes, founder of Docker:

"Different people use Docker for different purposes, that is normal  
and a fundamental goal of Docker. I do have criticism for your  
communication around that base image, starting with the link-bait blog  
post 'you're using Docker wrong'. Your message is that anybody not  
using Docker your way (full-blown init process, sshd, embedded syslog)  
is doing it wrong. That is not only incorrect, it contradicts Docker's  
philosophy of allowing and supporting more than one usage pattern."

[https://news.ycombinator.com/item?id=7950326](https://news.ycombinator.com/item?id=7950326)

--g

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [October 28, 2014, 5:06pm UTC](https://forum.ansible.com/t/configure-your-docker-with-ansible-without-ssh/16624/3 "2014-10-28T17:06:23Z")

</div>

There is also a connection=jail, so I think a docker or lxc connection plugin make sense.

As for ssh on docker being evil, it is only if you are using docker as a ‘run single immutable app’ container, for those using docker like a openvz/bsd jails lightweight VM it makes sense to run ssh.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [October 30, 2014, 5:12pm UTC](https://forum.ansible.com/t/configure-your-docker-with-ansible-without-ssh/16624/4 "2014-10-30T17:12:47Z")

</div>

One caveat is of course we have historically not implemented a “manage a Docker connection with SSH” kind of multi-hop connection type.

For the same reason, we don’t support management of remote jails, and the jail connection type remains only usable locally - and for that reason, we don’t really promote it.

Generally I think Docker images _are_ best used immutably, and most use cases will use ansible to build the image and then deploy it, but yes, there are valid reasons to want to SSH inside one.

I’d venture though that almost no one sets this up, as then you have to do the supervisor thing to run SSH because of the single-entrypoint problem.
