192 points · by AJAlabs · 10y ago · 78 comments
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.
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.
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.
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.
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.
[1] https://benchmarks.cisecurity.org/tools2/docker/CIS_Docker_1...
Instead, install using instructions here: https://docs.docker.com/engine/installation/linux/centos/#/i...
Source: https://github.com/projectatomic/docker/tree/410e23a7eeb52d4...