Ubuntu 12.04到docker“服务mysql启动”

我需要Ubuntu 12.04开发Web服务运行(sshd,apache2.2,php5.3,mysql服务器)。 我有Ubuntu 14.04,我安装了docker

然后,我开始容器:

docker run -t -i ubuntu:12.04 /bin/bash 

然后:

 apt-get update && apt-get install -y mysql-server 

之后:服务mysql启动,服务mysql状态不工作。 如果我运行14.04 Ubuntu的容器,它运作良好。 同样的问题是与sshd服务器。

服务apache2状态,服务apache2停止,服务apache2启动工作正常。

容器内没有运行init进程。 所以不能确定古代的水平。 如果有一个未知的运行级别,暴发户无法启动MySQL。 …参见/etc/init/mysql.conf

 ... start on runlevel [2345] ... 

如果您尝试检查运行级别:

 $ runlevel unknown 

…你看到它是未知的。

在Docker中,这是在前台启动应用程序的常用方法。

 /usr/bin/mysqld_safe 

如果你想启动多个应用程序,你可以使用supervisord。

http://supervisord.org/

https://docs.docker.com/articles/using_supervisord/

另外我找到了一个Dockerfile,它在ubuntu:12.04 docker容器中启动一个init。 真的很好的工作:

https://github.com/tianon/dockerfiles/blob/master/sbin-init/ubuntu/upstart/12.04/Dockerfile