There is an image by Phusion called baseimage-docker[2] which adds SSHd, init, syslog, and cron in an attempt to make Docker containers more like lightweight VMs. But in the #docker channel, I've seen people have issues with it. For example, one person had some /etc/init.d scripts that wouldn't start up (other ones started up fine). Turns out that one of the signals that init was waiting on to start that script was never getting sent (I think it was networking coming online?), and that was just a side effect of how Docker works that couldn't easily be fixed. The Docker maintainers in the channel discouraged using this image for these reasons.
[1]: https://groups.google.com/forum/#!msg/docker-user/pNaBYJkmnA...
See also my other comment which clarifies baseimage-docker's position: https://news.ycombinator.com/item?id=7951042
But about that pet x cattle analogy, there are plenty of SSH based tools for large scale management of servers. And it's still the best file copy tool available on any system (rsync is not an option here, because rsync is only good when it uses ssh).
But I think using ssh for large scale management of server largely misses the main benefits of Docker. One of the nice ways of using Docker is to replace tools that uses ssh to try to replicate vm states in various ways that are often hard to make 100% reproducible, with something that is entirely reproducible because it replicates the state exactly.
When you build a docker image, push it to an index, and deploy it on your test system, and then later on the production system, you know the container remains identical.
I'm fairly sure every cloud provider worth talking about has an image-based deployment system. Even an ESXi box, the sort of which exists in many small offices, does.
Both most of these solutions are far more heavy duty. I've shipped enough VM images all over the place to learn to hate the overheads compared to the very lean-ness of a typical Docker deploy.
It is a good/valid focus for them. However, it is not for everyone.
Single process is a single process. [e.g. Nginx]
I think you are confused by what I meant.
Stateless single purpose containers is good. One process per container is bad because it involves more service discovery before you actually need it.
Furthermore, you can easily set all of the containers to share the same networking namespace so they can all just listen locally if you wanted a turn key solution. The pretty trivial issue of single-host service discovery is not a very strong argument against the benefits of single process containers in my experience.
1) Multiple docker containers to spin up and be managed.
2) Multiple health checks.
3) Set additional flags/do additional config for Docker.
The fact people consistently say "Eh, this is a non-issue" is great. It means you are much luckier and more skilled than I since you can manage all of that with 0 additional effort.
For me, all of this is effort I don't need to expend.
If you are logging in to debug, you can log into the host.
Then when I start playing with a new application, I set up a new docker image for it, and has that docker image bind to a suitable subdirectory that is then shared with the "dev" image I ssh into.
This means I always have 100% up to date documentation of the requirements for running the app, in the form of the docker file.
I don't see a problem with running sshd in a Docker container. I do have a bit of an issue with "throwing a bunch of stuff" in the containers. If your purpose for having ssh there is to be able to investigate things, then I'd argue you don't really need it in most cases:
- You can copy files out of the containers with "docker cp"
- All the processes are visible and traceable from the host
- You can choose to export the important bits of the filesystem of the container, so that you can start a second container to inspect those bits more thoroughly (this can also be used to great effect to allow apps that needs to work on the same file sets to be isolated in separate containers).
- During dev/testing you can easily override the entrypoint and start a shell.
In practice I've found that while introspection of various forms is important during testing and development, there's also a certain benefit in not giving yourself direct access to easily modify stuff: It makes it easier to maintain discipline and update the Dockerfile etc. and rebuild containers.
If you also use e.g. systemd to run the containers, and log to the console, you get your logs concentrated via journald and optionally shipped on to rsyslog etc., and combined with the docker tools and careful use of exported volumes, there's very little state left where there's much need to ssh in to a specific container. There's also a tool (forget the name; EDIT: D'oh, it's "nsenter" that's presented in the article I'm thinking about) that let you run a process in the same cgroup namespaces as your container as well.
If anything, I'm leaning towards trimming the containers further, down to the bare essentials for each specific app.
Tbh I'd pay more attention to host key regeneration! Easily overlooked.
Until there's better investigation tooling available, sshd seems a fairly sensible approach.
MAC / SELinux prevents many other poke-inside techniques on enterprise platforms