-
Notifications
You must be signed in to change notification settings - Fork 0
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
phusion baseimage #1
Comments
I have actually seen that image before, and there is a lot to like about the things they've put in there. The short answer I guess as to why I don't use it is because I don't want to include so many things in a default image until I know I need them. I'd rather have many small images that are layered that add only the features they need instead of one big fat one that makes many assumptions about things that are needed. And it's not even a size thing, it only weighs about 80mb more than mine, I guess it's just principal. This image strikes me as really trying to get a container to be a full blown virtual environment for long running and multi-purpose containers. I could definitely see this image as a host for a "docker-in-docker" situation if I were to use it as my virtual "host" to make sure things are as close to normal as possible. I can even see this as a base for situations where docker is used to run remote X servers and other user/gui tools that expect such things as what they added in there. But for now, I'll leave it out until I know i need it or run up against problems in my images. And I may even just add pieces of their image as I need them into my images. To their credit too, I now know what to look out for as possible blind spots as I create my images. Did you have a specific need that their images offered? |
I just wanted to know if you were aware of that, before building your own base images. I like that it makes syslog and cron work. It has runit built in, supervisor is nice too, but I think runit is more stable and less memory. Also their start up script has command flags that can disable certain behaviours. IMO it'd be nice combine the work they did, with your ideas. Unless your container addresses all those issues that they describe already here and any other that came in via tickets and Google Group discussion. I don't remember exactly the problems they were running into, but there were some. Anyway, I am not married to it, and I haven't really explored what you are offering. I was just throwing it out there to see if you had any thoughts. |
I appreciate the suggestion. I'll keep this open for further discussion and I'll think on it too. Right now I have more ideas and strategy than actual examples and testing regarding my images, so I'll let myself run into these issues as Radial matures and keep their solutions in mind. My hunch is that it's easier from a "drop-in" configuration perspective to use supervisor for most of these tasks, but I'll definitely be revisiting this at a later date. |
My view on the phusion base image is:
As far as best practices go; it could be lighter and provide some of the components only if they are requested. There is Ubuntu Upstart which is a lot leaner and you can add the components as you need them.
|
|
@moltar also we should keep in mind that anything from Phusion is a product; it's goal it to make users who use those products happier. That's not a bad thing; and I do think both answers are completely valid.
Refactoring is a pain to adopt better standards. |
@moltar @damm As for Phusion's selling points, I did some homework on it and am riffing off that list:
Supervisor can manage the processes just fine. There shouldn't be rogue processes going on anyway that can go "zombie", so supervisor scripts for start/stop and other admin processes are the way to go. Just SSH into the container, and everything you would ever want to do to your process should be pre-scripted and then run with
This fix was baked into the official Ubuntu image eventually anyway. So I'm not sure why they are taking credit for it on their page.
syslog-ng looks great. I don't have any experience with it however, but it seems they're only using it for basic features, which of course, Supervisor is already doing by being the init system. They also seem to forget that Docker containers share the kernel with the host, so outside of your specific process's log (Supervisor), the output of syslog and dmesg aren't relevant or unique to your container (dmesg in your container is the same output as running it on the host).
Supervisor
got one of those too by default in my spoke container. Same hardened settings. Key-only access. disable via Supervisor .ini if you like.
I can't stand using cron on real systems, and I hope I never have to use it in my containers. I think what they need it for is log-rotate tasks. To that I say "Supervisor".
I thought we already handled init? Not sure if I'm comfortable using runit, I've never really heard of it before or know anything about. It In any case....Supervisor!
This is kinda cool. But again...Supervisor can run processes as any user desired. So it really comes down to whether we like doing everything in one program, and specifying all of init/logs/start|stop/processes/user/etc.. in one configuration file (Supervisor) or having to make our own init scripts and try to catch everything in our own nonstandard scripts for our own non-standard init system... no, thank you. 1 program doing everything is better then >1 programs in this case, even at the cost of a couple megabytes of ram (Supervisor is ~13mb I think, but my image is smaller 😋 ) Besides, one of my main goals with Radial was to keep configuration simple and very manageable so that I can splice different pieces together with git and not add very many files when building apps. Thanks anyway @moltar for the suggestion, I saw that image before and how popular it was, but didn't really dig deeper into their methods. Glad you gave me a reason to do that! |
Basically they tried nicely but there were enough (sometimes rude) users who did not take the suggestion to not use a container as a full server well. You still see people mentioning how you should use single process containers but you can't force people to get it. So they don't beat a dead horse. UpstartWe should talk about some of the problems about Upstart before we start selling it; There was someone in #docker the other day having problems getting mysql-server to start using the upstart by default; tianon was going to look into this I believe.
LoggingReally we don't want any logging collection done in the container; /dev/log can drop if there is enough messages coming through so forwarding your logs to a central point (via logstash or whatever) is the way to go.
SSHThere's people for or against this. I'm against this because unless you do this with SSH Host Certificates you cannot validate the public RSA key. Basically if your throwing up SSH you should give it a certificate; if you can't you should not /enable it/ because it's a door. If you need access to your container use nsinit or nsenter. CronThere are many alternatives to cron out there; truthfully vixie cron is horrible and is known to loosing the crontabs from time to time. You should just replace cron instead of using it. RunitHuh? SecurityYou mention setuser; but really we shouldn't be giving the user root at all. These are containers; you could treat them as a hands off approach. But really allowing SSH connections to sudo is just asking for you to get owned. |
If we were to head single process per container, then why do we even need supervisor or upstart or any of that? Just run it via CMD / ENTRYPOINT and log to stdout. That would also prevent SSH, and log collection from inside the container. |
@brianclements: setuser especially shines when you actually build the container and need a bunch of stuff done from other user's permissions, this saves from chown'ing everything at the end. |
@damm: what the good alternatives to cron? P.S. Sorry for multiple messages - early - mind is all scattered. |
@moltar here are 3 alternatives; there are more out there
Additionally if you use a single container; there maybe a time when you need to say deploy or run tasks? Either have a image that you would --volume-from to get your content and run your deploy script and exit. Re-using your images and containers to get to your content also provides a more secure mechanism than SSH'ing into a public port.
and really my point about setuser is don't. Just set your USER in your Dockerfile as a non privileged user; don't allow them to su/sudo and win. |
@damm: these are not cron replacements!
Sometimes you just need to run once-in-a-while maintenance tasks that cron handles best. It is not meant to be reliable like MQs. Stuff like, deleting temporary files, clearing expired sessions from the database, fetching some data from a remote location, that is not mission critical (e.g. maxmind updates), and so on. Alternative, I guess, it would be possible to run new docker container from the host via host's cron, attaching needed data via --volume-from and then doing said maintenance. |
@moltar
So to respond to 2. I kinda felt the same way until I watched a few guys setup everything by hand just to have Chronos. Must be something in the water. So to quash a few assumptions; not all rails apps use redis nor resque; but a lot do. There are alternatives but overall due to some failures in regular vixie crontab you can still see people running a script that will Lastly it's not really security that I say SSH is bad; it's more of proper mechanics. If we use |
@damm: I am sensing some "Not invented here" anti pattern smell ;) I am not using either Ruby or Python. I am using Perl. There are cron-like "solutions" in Perl as well, but I choose to avoid them in favour of old & tested cron. I have never experienced any problems aside from having to deal with the environment variables. |
@moltar the old tested and true of cron is no longer true. That was one of my original points; it's not as reliable as people assume. There are alternatives; albeit not always great but cron should not be a service in your containers as there are many services not fully setup to alert you when crons go bad.
A bad pun.
|
Wow, so much here, let me begin:
In my experience, extracting logs via the So that alone warrants Supervisor's use or at least some other method of log processing. But also I would imagine that not all containers are simply "hands-off" once run. Databases need maintenance and sometimes processes have multiple steps in order to start|stop|reload in subtle ways that a simple
I'm not sure what setuser offers that I can't do using normal bash and Dockerfile features. In the docker file, I can actually switch users mid-file with a
I'm currently asking this question on the docker-user group because I'm not sure about how to go about that. I don't have much experience with databases so I don't know which of those maintenance tasks come up frequently and how to go about them (for now). I really like the idea of having my database data in a shared volume upon which a specialized "maintenance container" can be run whenever with |
|
@damm I really appreciate your input to this conversation. I am really excited to learn more about the OpenSSH Certificates, that absolutely feels like THE solution to the docker ssh/key problem in containers; I wasn't aware of that before and want to put that in my images (the pending "dev" flavors of course, not production in light of your recommendation). I really like your logging suggestions too. But all I can find is artifacts of LoggerFS on the web, which is the most recent source that you use? |
@brianclements LoggerFS was announced the other week and based on the HN comments and the lack of being able to find actual code; might not be out yet. I had bookmarked the page and was going to evaluate it next week, good thing I looked now. SSH Host keys normally don't change on a system; if you use EC2 you likely accept the default unique host key per instance; it just makes it difficult to trust without a way to display (in a way you trust) what the public key should be. Having an SSH Certificate is fairly easy you would just modify
|
Have you seen this? Why not use that as a base image for this setup?
The text was updated successfully, but these errors were encountered: