进入docker执行systemctl start mysqld.service 发现报错
这里写图片描述
解决办法:
首先执行:docker run -d -e “container=docker” –privileged=true -v /sys/fs/cgroup:/sys/fs/cgroup –name centos7 centos /usr/sbin/init

[root@iZwz91s6lw79velxoim303Z /]# docker run -d -e "container=docker" --privileged=true -v /sys/fs/cgroup:/sys/fs/cgroup --name centos7 centos /usr/sbin/init  
Unable to find image 'centos:latest' locally
Trying to pull repository docker.io/library/centos ... 
latest: Pulling from docker.io/library/centos
85432449fd0f: Pull complete 
Digest: sha256:3b1a65e9a05f0a77b5e8a698d3359459904c2a354dc3b25ae2e2f5c95f0b3667
78080535f11298155b74f1a533d5f926e7292c7b7dd4b83dc1bca9dd0dc1504e

然后查看容器ID

[root@iZwz91s6lw79velxoim303Z /]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
78080535f112        centos              "/usr/sbin/init"    4 minutes ago       Up 4 minutes                            centos7

进入容器:
[root@iZwz91s6lw79velxoim303Z /]# docker run -it 78080535f112 /bin/bash

安装完毕mysql之后执行systemctl start mysqld.service就不报错了
这里写图片描述

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐