Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

ubuntu 12.04 into docker "service mysql start"

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.

Then i started container:

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

Then:

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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

/usr/bin/mysqld_safe

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

http://supervisord.org/

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...