Here's my current workaround. I don't completely understand why it works,
because I arrived at it through trial-and-error, but here it is:


*Vagrantfile snippet:*

    v.vm.provider "docker" do |d|
      #d.build_dir = "./myproject_db"
      d.image = "cbanbury/centos-docker"
      d.has_ssh = true
      d.remains_running = true
      d.ports = ["3306:3306"]
      d.cmd = ["#{vm_db_script_dir}/start.sh"]
    end

*start.sh:*

#!/usr/bin/env bash
set -e

# start this in background ("&"). the background part seems to be very
important.
/usr/bin/mysqld_safe || true &

# start sshd as a daemon, to keep the container open. TODO: understand this
a little better, because i'm not sure why mysqld_safe wouldn't keep it open.
/usr/sbin/sshd -D



On Tue, Oct 28, 2014 at 5:32 PM, Jamie Jackson <jamieja...@gmail.com> wrote:

> Hi Folks,
>
> Is there a trick to installing/running MySQL in a Docker container through
> Vagrant?
>
> Everything is fine with the initial provision (which does the MySQL
> installation, in a CentOS 6.5 container, FWIW)--it results in the MySQL
> daemon running; However, if I vagrant reload, the daemon is stopped. I
> haven't figured out how to get the daemon to start automatically on vagrant
> up after that first time.
>
> Thanks,
> Jamie
>

-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vagrant-up+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to