Docker and Canonical Partner on Commercially-Supported Docker Engine for Ubuntu
docker.com
docker.com
I suppose this can be sidestepped by allowing root in all of your containers for the applications. I am curious if that actually provides security benefits, though.
First, you'll find that the user used to setup the container was not you. So you can't even just map in your .ssh dir.
So you'll try modifying the image to work with specified user at start up. Only, again, it wasn't setup that way. You will start modifying the entire image to work, but will hit tons of assumptions on user name. (You may get lucky here. I didn't.)
So then you think to just run as root so that the user in the container will have permission to your .ssh files. At first you forget to specify user name on ssh commands, since the command thinks you are root now. easy enough, at least.
Only, you forgot you have proxy commands in your config and other scripts that you now have to edit because they rely on your user name. So you can fix that.
Now you can finally do what would have been trivial for an app installed on your machine.
I have been making end-user apps for myself and for folks at work that require such identity, in one case, ~/.ssh, and in another, ~/.gnupg.
My solution isn't particularly novel or clever, but it works well.
The docker image of the command-line app is the same for all users, and so lacks their identity built in.
The hack is to drive invocation of the docker image with a shell script that makes a temporary directory, copies in the necessary identity files from ~, and does a docker run that maps those identify files into the docker image.
After the docker image exits, the bash invocation script cleans up.
It's a hack, but it works surprisingly well. In my tests, it adds about 100ms of invocation latency for a python program. That is, running the docker image containing a python program that copies some files in as described is about 100ms slower than just running the same python program directly.
It would be nice to have a more elegant solution to this, but it's not too bad.
If you're using ssh-agent, maybe you could bind-mount your host's $(dirname $SSH_AUTH_SOCK) into the container, and then set the SSH_AUTH_SOCK environment variable to point at it when you run the Docker container. That way you're not even sharing the private key with the container.
I imagine you could do the same with gpg-agent, too.
I didn't mention it, but for one of the apps, I also needed ~/.gitconfig, which I don't think has an agent. :(
I thought of the ssh-agent trick, but never thought of how to actually do it and moved on to other problems.
I would love to hear thoughts on better ways to fix this. Apologies for not responding earlier, as I really want this conversation to end somewhere. I just feel ashamed that I don't know how to continue it.
I do want to throw out there that this should not keep folks from trying docker. Please try it. Even better, suggest ways to advance this use case.
This is an interesting problem, and I would think one that a lot of people are experiencing.
Seems like an area of opportunity to make docker images a lot more flexible.
What's wrong with using ye olde Kerberos and LDAP to accomplish this exactly?
Again, an example is easiest. (Will also shed light on if I am actually doing something wrong. Entirely in the realm of plausible.)
So, you have a file share with your data, scoped to user "cheez". You can ssh to machine "remote" and see this data. You can copy this data over to your machine, call it "local" and it will still be scoped to your user, "cheez". This is great, as you don't have to worry about someone else accidentally getting access to it.
However, you decide to use "container A" to run some analysis on this data. The folks that setup "container A" did so using the username "container". You mount your data on a volume to "/my/data". You check, and the container can now see it, but user "container" does not have permission to do anything with it.
You have plenty of options at this point. You can give public permissions to see the data in the directory. You can launch ssh from in the container and copy the data in. (Note that this way will have the data in the container as belonging to "container" which will make similar concerns on egress.)
You can also run the container as "root" which will clearly have permission. However, recognize the concerns with this approach, as this also gives you permission to see any other file in that directory that "cheez" wouldn't normally have permission to see.
You can also recreate the container such that "cheez" is the user that is created in the container. This sounds great, but redoing the entire setup of the image has a few problems. Not to mention the security implications this has, since you could also recreate the image with the user of your boss and circumvent some other security measures of your machine.
Now, if your container doesn't set anything up in userspace (defined as "not root") until launch of the container, much of this concern goes away. Not all of it, I believe, but most. However, anything that you want to run "in the container" using your identity from "out of the container" seems to fall into this trap. It is subtle, but gets in the way of a lot of use cases.
https://medium.com/@ramangupta/why-docker-data-containers-ar...
To be clear, as a service deployment mechanism, this is fine. As an end user tool, this blows. Unless every container builds in support for LDAP or Kerberos, then each container is effectively a new computer on the network without auth setup in a meaningful way.
Basically, instead of host -> container, you do container -> container.
And yeah, the container is supposed to be effectively a new computer, but you can build images to create the auth environments you need and base everything off those.
The use case I have above is a real one. Somehow try to share your .ssh folder with a utility container sometime.
User namespaces somewhat help. But fall flat for the case of "still being you" on a container.
It can be comical even for the intended two containers choice. Unless both use the same uid:gid to write files, one container will not be able to read the other containers data.
If it's just the aesthetics of the solution, then you have a way forward. But if it is literally impossible to get data on and off a container, then you have a problem.
Does it just have a different release process/QA process to allow for more stable use in deploy environments bundled with a support contract?
At a not so distant future point, Docker will be delivered as a snap package. Users installing docker via `apt-get` will ultimately be installing the snap.
We are working through the final technical details of this portion now. We'll make sure to keep everyone updated as this transition happens, but current best practices should continue to Just Work.
A new packaging format would have been great time for Linux to converge around the biggest usability+discoverability+ availability problem that the platform has. While developers need to release one binary for osx or Windows...they need to release atleast 4 for different Linux flavors.
Is there any chance that there could be convergence around the new static packaging that everyone is reinventing?
Lots of little "islets", not so much an "archipelago".
The push towards static packaging is a great time to unify. The problem is that snap is based on deb..not sure about Flatpak. So we again have a political split.
I really think this is the opportunity to unify Linux packaging - anything, I don't care..but let us please have one package format.
http://arstechnica.com/information-technology/2016/06/here-c...
They have built a great open source product, but now that there has been a collective shift to understanding the benefits of containers, the docker runtime + container format will/should be commoditized by infrastructure companies (Google, RedHat, MS etc).
So where is the value-add of Docker the company going to come from?
edit: s/evaluation/valuation
Snaps is a package format that gives you a cross (linux) platform distribution, atomic updates, security, and isolation. It's not really like docker as it's not a density story, there's no unique TCP/IP stack, etc.
or the VM security
I get that containers will always have a larger attack surface than Xen/KVM. Just thought it was worth mentioning that some container approaches are thinking about security more than others.
It's a trade off, but one that seems to trend towards more secure despite potentially a few quirks.
LXD is more like KVM in that gives you "guests" that feel like a full OS. You can run existing apps in there in exactly the same way you would run them in a VM.
So these are two counterparts in the container continuum, and it's useful to understand them both so you use the right thing at the right time.
LXC is based on cgroups and kernel namespaces - the exact same things that enable Docker-based containers. LXD and Docker engine are competing "container"-based virtualization engines.
LXC can can be run as app-based containers just like Docker. This is what lxc-execute does. You don't have to run init as pid 1 in LXC.
By the way "Cloud-native" is little more than a marketing term.
Source: https://github.com/projectatomic/docker/tree/410e23a7eeb52d4...
[1] https://benchmarks.cisecurity.org/tools2/docker/CIS_Docker_1...
Instead, install using instructions here: https://docs.docker.com/engine/installation/linux/centos/#/i...