问题遇到的现象和发生背景
准备用docker启动mysql5.7.38的容器,在容器里部署keepalived,我试了很多办法都没法用systemctl启动keepalived
问题相关代码,请勿粘贴截图
[root@node1 mysql]#
a
docker run -d --net host --name mysql-keepalived --privileged=true \
-v /etc/localtime:/etc/localtime
-v /root/mysql/data:/var/lib/mysql
-v /root/mysql/log:/var/log/mysql
-v /root/mysql/my.cnf:/etc/my.cnf
-e MYSQL_ROOT_PASSWORD='mysql@2022'
mysql:5.7.38 /usr/sbin/init
运行结果及报错内容
[root@node1 mysql]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e7027be136b6 mysql:5.7.38 "docker-entrypoint.s…" 4 seconds ago Exited (1) 3 seconds ago mysql-keepalived
[root@node1 mysql]# docker logs -f mysql-keepalived
/usr/local/bin/docker-entrypoint.sh: line 400: /usr/sbin/init: No such file or directory
我的解答思路和尝试过的方法
bash-4.2# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)
系统版本是这个,我尝试网上的方法添加这个命令/usr/sbin/init,但是并没有这个东西,网上查找了很多都没看见类似的问题
我想要达到的结果
正常在mysql容器里启动keepalived