ubuntu 12.04进入docker“service mysql start” [英] ubuntu 12.04 into docker "service mysql start"

查看:168
本文介绍了ubuntu 12.04进入docker“service mysql start”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要ubuntu 12.04开发web服务运行(sshd,apache2.2,php5.3,mysql-server)。我有ubuntu 14.04,我安装了docker。

I need ubuntu 12.04 with developing web-services running (sshd, apache2.2, php5.3, mysql-server). I have ubuntu 14.04, i installed 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服务器。

After that: service mysql start, service mysql status is not working. If i am running container with 14.04 ubuntu, it works well. The same issue is with sshd server.

service apache2 status,service apache2 stop,service apache2 start works well。

service apache2 status, service apache2 stop, service apache2 start works well.

推荐答案

容器内没有运行init进程!因此,无法确定符文级别。
如果有一个未知的运行级别,upstart不能启动mysql。 ...请参阅/etc/init/mysql.conf

There is no init process running inside the container! Therefore the runelevel can't be determined. If there is an unknown runlevel, upstart can not start mysql. ... see /etc/init/mysql.conf

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

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

If you try to check the runlevel:

$ runlevel
unknown



... you see it is unknown!

在Docker中,它是在前台启动应用程序的常见方式。

In Docker it is the common way to start the application in foreground.

/usr/bin/mysqld_safe

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

If you want to start more than one application, you can use supervisord.

http://supervisord.org/

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

另外,我发现一个Dockerfile,它在ubuntu:12.04 docker容器中启动一个init。真的很棒的工作:

Additional i've found a Dockerfile, which starts a init inside a ubuntu:12.04 docker container. Really nice work:

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

这篇关于ubuntu 12.04进入docker“service mysql start”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆