TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Vagrant Feature Preview: Docker-Based Development Environments

329 pointsby BummerCloudabout 11 years ago

21 comments

jbertabout 11 years ago
I&#x27;ve just started using docker (I had to reimage my linode to take advantage of the recent upgrade). I&#x27;ve got nginx and postfix containers running. If anyone can offer some thoughts on the following points I&#x27;d be grateful.<p>1) I built two Dockerfiless on my laptop (one for nginx, one for my postfix setup) tested locally, then scp&#x27;d the Dockerfiles over to the server, built images and ran them. I didn&#x27;t really want to pollute the registry with my stuff. Is this reasonable? For bigger stuff, should I use a private registry? Should I be deploying images instead of Dockerfiles?<p>2) The nginx setup I deployed exports the static html as a VOLUME, which the run command binds to a dir in my home dir, which I simply rsync when I want to update (i.e. the deployed site is outside the container). Should I have the content inside the container really?<p>3) I&#x27;m still using the &#x27;default&#x27; site in nginx (currently sufficient). It would be kind of nice to have a Dockerfile in each site I wanted to deploy to the same host. But only one can get the port. I sort of want to have a &#x27;foo.com&#x27; repo and a &#x27;bar.org&#x27; repo and ship them both to the server as docker containers. Don&#x27;t really see how to make that work.<p>What I think I want is:<p>- a repo has a Dockerfile and represents a service<p>- I can push these things around (git clone, scp a tgz, whatever) and have the containers &quot;just run&quot;<p>Not sure how to make that fit with &quot;someone has to own port 80&quot;
评论 #7669533 未加载
评论 #7670112 未加载
评论 #7669325 未加载
评论 #7669279 未加载
jeffbr13about 11 years ago
I currently have an ansible script which can set up a web-service on any Debian&#x2F;Ubuntu box, and can be invoked<p>1) over SSH, or 2) by Vagrant when provisioning a VM.<p>Docker, on the other hand, provisions it&#x27;s containers from a rather simplistic Dockerfile, which is just a list of commands. The current solution to provision a container through ansible is rather messy[1], and shows that Docker&#x27;s configuration doesn&#x27;t display the same separation-of-responsibilities as Vagrant&#x27;s does.<p>Luckily, this lets me use Docker as another provider through the Vagrant API. Woooo!<p><a href="http://www.ansible.com/blog/2014/02/12/installing-and-building-docker-with-ansible" rel="nofollow">http:&#x2F;&#x2F;www.ansible.com&#x2F;blog&#x2F;2014&#x2F;02&#x2F;12&#x2F;installing-and-buildi...</a>
评论 #7671253 未加载
评论 #7669541 未加载
评论 #7671815 未加载
tonyhbabout 11 years ago
This is really cool. It&#x27;d be great to be able to piece together development environments from dockerfiles even quicker than you can now.<p>One of the great things about docker is that once you&#x27;ve played about for an hour or so you&#x27;ve already picked up most of it. It&#x27;s not like Chef or Puppet – configuring environments using VirtualBox and a VM is really simple. I wonder how fast this will make things.
sicularsabout 11 years ago
I&#x27;ve been looking for a way to integrate docker into my existing workflow. This integration takes nothing away from Docker and just makes Vagrant that much more flexible and valuable to teams already using it and newcomers. Can&#x27;t wait to run this through its paces.<p>Curious, how is the default &quot;proxy&quot; vm on macs sized?
评论 #7671817 未加载
mattjaynesabout 11 years ago
This is a really great step forward - thanks Mitchell!<p>I&#x27;ve recently spent a couple of weeks doing a deep dive into Docker, so I&#x27;ll share some insights from what I&#x27;ve learned.<p>First, it&#x27;s important to understand that Docker is an advanced optimization. Yes, it&#x27;s extremely cool, but it is not a replacement for learning basic systems first. That might change someday, but currently, in order to use Docker in a production environment, you need to be a pro system administrator.<p>A common misconception I see is this: &quot;I can learn Docker and then I can run my own systems with out having to learn the other stuff!&quot; Again, that may be the case sometime in the future, but it will be months or years until that&#x27;s a reality.<p>So what do you need to know before using Docker in production? Well, basic systems stuff. How to manage linux. How to manage networking, logs, monitoring, deployment, backups, security, etc.<p>If you truly want to bypass learning the basics, then use Heroku or another similar service that handles much of that for you. Docker is not the answer.<p>If you already have a good grasp on systems administration, then your current systems should have:<p><pre><code> - secured least-privilege access (key based logins, firewalls, fail2ban, etc) - restorable secure off-site database backups - automated system setup (using Ansible, Puppet, etc) - automated deploys - automated provisioning - monitoring of all critical services - and more (I&#x27;m writing this on the fly...) </code></pre> If you have critical holes in your infrastructure, you have no business looking at Docker (or any other new hot cool tools). It&#x27;d be like parking a Ferrari on the edge of an unstable cliff.<p>Docker is amazing - but it needs a firm foundation to be on.<p>Whenever I make this point, there are always a few engineers that are very very sad and their lips quiver and their eyes fill with tears because I&#x27;m talking about taking away their toys. This advice isn&#x27;t for them, if you&#x27;re an engineer that just wants to play with things, then please go ahead.<p>However, if you are running a business with mission-critical systems, then please please please get your own systems in order before you start trying to park Ferraris on them.<p>So, if you have your systems in order, then how should you approach Docker? Well, first decide if the added complexity is worth the benefits of Docker. You are adding another layer to your systems and that adds complexity. Sure, Docker takes care of some of the complexity by packaging some of it beautifully away, but you still have to manage it and there&#x27;s a cost to that.<p>You can accomplish many of the benefits of Docker without the added complexity by using standardized systems, ansible, version pinning, packaged deploys, etc. Those can be simpler and might be a better option for your business.<p>If the benefits of Docker outrank the costs and make more sense than the simpler cheaper alternatives, then embrace it! (remember, I&#x27;m talking about Docker in production - for development environments, it&#x27;s a simpler scenario)<p>So, now that you&#x27;ve chosen Docker, what&#x27;s the simplest way to use it in production?<p>Well, first, it&#x27;s important to understand that it is far simpler to manage Docker if you view it as role-based virtual machine rather than as deployable single-purpose processes. For example, build an &#x27;app&#x27; container that is very similar to an &#x27;app&#x27; VM you would create along with the init, cron, ssh, etc processes within it. Don&#x27;t try to capture every process in its own container with a separate container for ssh, cron, app, web server, etc.<p>There are great theoretical arguments for having a process per container, but in practice, it&#x27;s a bit of a nightmare to actually manage. Perhaps at extremely large scales that approach makes more sense, but for most systems, you&#x27;ll want role-based containers (app, db, redis, etc).<p>If you&#x27;re still not convinced on that point, read this on microservices which points out many of the management problems: <a href="http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html" rel="nofollow">http:&#x2F;&#x2F;highscalability.com&#x2F;blog&#x2F;2014&#x2F;4&#x2F;8&#x2F;microservices-not-a...</a><p>You probably already have your servers set up by role, so this should be a pretty straight-forward transition. Particularly since you already have each system scripted in Ansible (or similar) right?<p>To run Docker in a safe robust way for a typical multi-host production environment requires very careful management of many variables:<p><pre><code> - secured private image repo (index) - orchestrating container deploys with zero downtime - orchestrating container deploy roll-backs - networking between containers on multiple hosts - managing container logs - managing container data (db, etc) - creating images that properly handle init, logs, etc - much much more... </code></pre> This is not impossible and can all be done and several large companies are already using Docker in production, but it&#x27;s definitely non-trivial. This will change as the ecosystem around Docker matures (Flynn, Docker container hosting, etc), but currently if you&#x27;re going to attempt using Docker seriously in production, you need to be pretty skilled at systems management and orchestration.<p>There&#x27;s a misconception that using Docker in production is nearly as simple as the trivial examples shown for sample development environments. In real-life, it&#x27;s pretty complex to get it right. For a sense of what I mean, see these articles that get the closest to production reality that I&#x27;ve found so far, but still miss many critical elements you&#x27;d need:<p><a href="http://code.tutsplus.com/tutorials/easily-deploy-redis-backed-web-apps-with-docker--cms-20405" rel="nofollow">http:&#x2F;&#x2F;code.tutsplus.com&#x2F;tutorials&#x2F;easily-deploy-redis-backe...</a><p><a href="http://www.powpark.com/blog/programming/2014/01/29/integrating-docker-with-jenkins-for-ruby-on-rails-app" rel="nofollow">http:&#x2F;&#x2F;www.powpark.com&#x2F;blog&#x2F;programming&#x2F;2014&#x2F;01&#x2F;29&#x2F;integrati...</a><p><a href="http://blog.buddycloud.com/post/80771409167/using-docker-with-github-and-jenkins-for-repeatable" rel="nofollow">http:&#x2F;&#x2F;blog.buddycloud.com&#x2F;post&#x2F;80771409167&#x2F;using-docker-wit...</a><p><a href="https://journal.paul.querna.org/articles/2013/10/15/docker-ubuntu-on-rackspace/" rel="nofollow">https:&#x2F;&#x2F;journal.paul.querna.org&#x2F;articles&#x2F;2013&#x2F;10&#x2F;15&#x2F;docker-u...</a><p>(If you know of better ones, please share!)<p>To recap, if you want to use Docker in production:<p><pre><code> 1. Learn systems administration 2. Ensure your current production systems are solid 3. Determine whether Docker&#x27;s benefits justifies the cost 4. Use role-based containers </code></pre> Shameless plug: I&#x27;ll be covering how to build and audit your own systems in more depth over the next couple months (as well as more Docker stuff in the future) on my blog. If you&#x27;d like to be notified of updates, sign up on my mailing list: <a href="https://devopsu.com/newsletters/devopsu.html" rel="nofollow">https:&#x2F;&#x2F;devopsu.com&#x2F;newsletters&#x2F;devopsu.html</a>
评论 #7670740 未加载
评论 #7670670 未加载
评论 #7672473 未加载
评论 #7671433 未加载
评论 #7671431 未加载
moondevabout 11 years ago
Fantastic! Was just about to look into using docker with our current vagrant workflow.
zyangabout 11 years ago
Vagrant was a huge step forward for managing vm environments, but I&#x27;m afraid its integration with Docker is forced and misguided.<p>For instance, the idea of ssh provisioner does not jive with Docker. The better approach is run the container with shared volume, and run another bash container to access the shared volume. If you are just starting to look at Docker, I would recommend to use Vagrant to provision the base image, and leave the heavy lifting to Docker itself.
评论 #7668913 未加载
评论 #7668916 未加载
christopabout 11 years ago
This looks promising, though the message &quot;Warning: When using a remote Docker host, forwarded ports will NOT be immediately available on your machine&quot; was a bit disappointing.<p>Given that it transparently wraps boot2docker and handles proxying SSH connections, I had hoped that it would also transparently manage the port forwarding to the host VM, as that&#x27;s a much more common use case with Docker than SSH access.<p>Nonetheless, it looks nice!
_zenabout 11 years ago
I have wanted this since Docker was announced last year. In my eyes the biggest gain of Docker for development over VMs is boot time. Now I can turn all my Vagrant VBoxes to Docker containers, and work much faster. Thanks to all the maintainers for the hard work.
评论 #7671122 未加载
jsmeatonabout 11 years ago
Can someone explain to me - are containers based on a base OS, or are they capable of running on any OS? I see the &#x27;run anywhere&#x27; taglines and it just doesn&#x27;t make sense to me.<p>I imagine that docker containers have to be provisioned in some way, and if you&#x27;re provisioning with `apt-get` then it&#x27;s not going to work when deploying to a redhat OS.<p>Essentially, I understand Docker containers to be lightweight virtual machines rather than applications that can be deployed to anything running the docker service. Am I on the right track?
评论 #7671661 未加载
评论 #7671634 未加载
评论 #7671417 未加载
labianchinabout 11 years ago
I wonder if Vagrant will eventually do what Fig[1] does.<p>[1] <a href="http://orchardup.github.io/fig/" rel="nofollow">http:&#x2F;&#x2F;orchardup.github.io&#x2F;fig&#x2F;</a>
评论 #7670739 未加载
girvoabout 11 years ago
This is the best piece of news to start my Wednesday morning that I could&#x27;ve asked for. I&#x27;ve been slowly converting the entire team in the office over to Vagrant, and am using it for everything. I recently started playing with Docker and wanted to explore deployment of our web apps using it, and now I&#x27;ll be able to slot it in to my existing workflow! Vagrant is amazing :)
mu_phyabout 11 years ago
What&#x27;s the ETA for 1.6?
jwarrenabout 11 years ago
Bit late to this game, but in theory would this let me do the following?<p>1. Set up a VM using CentOS to mimic my deployment environment<p>2. Distribute that to several people, including some running Windows and OSX, and have it automatically set up, with all parties reliably in exactly the same environment.
评论 #7669663 未加载
po84about 11 years ago
Does Vagrant do any setup to allow you to run Docker within the dev container, say if you&#x27;re working on a project that you wish to ship as a Docker container image?
i386about 11 years ago
Can I publish docker images I create with vagrant to the index? What does that workflow look like?
评论 #7671839 未加载
评论 #7672019 未加载
kniteabout 11 years ago
These feature previews need a download link, or at the very least a release date.
SEJeffabout 11 years ago
So when is this going to be hooked up with consul for a bit more magic?
评论 #7669222 未加载
wodzuabout 11 years ago
Any idea as when can we expect 1.6 being shipped?
lilsunnybeeabout 11 years ago
Is anyone else really offended by the name of their product? I mean why didn&#x27;t they name it Gypsy or Hindu, maybe Eskimo or Shemale? So many groups out there just waiting to be further denigrated, trivialized and then commoditised. Fuck these guys.
评论 #7669696 未加载
评论 #7669707 未加载
评论 #7669860 未加载
评论 #7671638 未加载
rartichokeabout 11 years ago
I almost got excited but then yawned.<p>It&#x27;s nice but it still doesn&#x27;t fix the issue with people who have medium end machines where you develop in a VM full time and want to be able to run a VM within a VM.<p>For example with fairly old but still reasonable hardware you cannot run virtualbox inside of an existing virtualbox instance.<p>If you have a windows box and develop full time in a linux VM you cannot run vagrant inside of that linux VM because unless you have a modern CPU it lacks the instruction sets required to run virtualization within virtualization.<p>Now using docker instead of a VM would work but docker only supports 64 bit operating systems so anyone stuck with a 32bit host OS still can&#x27;t use vagrant and has to resort to using raw linux containers without docker which is really cumbersome.
评论 #7670329 未加载