Docker container usage problem: Failed to get D-Bus connection: Operation not permitted
In CentOS7, after yum installs mysql in the docker container, start mysqld and report an error
# systemctl start mysqld
Failed to get D-Bus connection: Operation not permitted
Solution :
Build the container:
#docker run -itd -name mysql mysql-yum-install /usr/sbin/init
into the container:
# docker exec -it mysql /bin/bash
This will start the service using systemctl.
Execute the code:
[root@vm ~]# docker run -itd --name mysql mysql-yum-install /usr/sbin/init
fc57c212614e013f22720ba471d5dd0ba0c203e629500818a568f55c7bfd1775
[root@vm ~]# docker exec -it mysql /bin/bash
[root@fc57c212614e /]# systemctl start mariadb
[root@fc57c212614e /]#