7

I have a docker with Ubuntu 16.04 and trying to install mysql-server in it. Installation went fine (apt-get install -y mysql-server) and now is time to run a server:

systemctl status mysql
Failed to connect to bus: No such file or directory

How to find/install systemctl for Ubuntu 16.04 (docker) and are there alternatives?

Joe
  • 11,983
  • 31
  • 109
  • 183
  • 1
    Related question in askubuntu: https://askubuntu.com/q/813588/145464 – 1615903 Mar 27 '18 at 04:25
  • More than likely, the answer is that you don't want to do this. You should be running the mysql binary in the foreground by itself. – BMitch Apr 07 '18 at 11:01
  • It does not matter if the OP should do this or not. The VAST majority of people reading this are looking for an answer to the question as asked (how to get systemctl on docker in Ubuntu) NOT how to run a mysql container. Any workaround or solution to the OP's particular issue is irrelevant. – Peter Kionga-Kamau Apr 20 '22 at 01:36

2 Answers2

5

Systemd is not installed on the ubuntu docker image. You can use the "service" command

service mysql start
service mysql status

You can also use the mysql docker image instead of installing mysql manually on ubuntu.

Thilina
  • 114
  • 1
  • 5
1

Ubuntu 16.04 is based on systemd, and systemctl tries to contact the daemon via d-bus. There are a number of solutions to solve this problem, one may be docker-systemctl-replacement.

Guido U. Draheim
  • 3,038
  • 1
  • 20
  • 19