Ubuntu 12.04 in docker "service mysql start"

I need ubuntu 12.04 when developing web services (sshd, apache2.2, php5.3, mysql-server). I have ubuntu 14.04, I have docker installed.

Then I started the container:

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

      

Then:

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

      

After that: mysql start service, mysql status service is not running. If I run a container with 14.04 ubuntu it works well. This same issue is related to the sshd server.

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

+3


source to share


1 answer


There is no initialization process in the container. Therefore, the runic level cannot be determined. If there is an unknown runlevel, the upstart cannot 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, this is the usual way to run an application in the foreground.



/usr/bin/mysqld_safe

      

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

http://supervisord.org/

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

Additionally, I found a Dockerfile that runs init inside the ubuntu container: 12.04 docker. Really nice job:

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

+8


source







All Articles