Bug 1400 - 使用anolisos的docker版构建的MariaDB容器无法启动mariadb.service
Summary: 使用anolisos的docker版构建的MariaDB容器无法启动mariadb.service
Status: CONFIRMED
Alias: None
Product: Anolis OS 8
Classification: Anolis OS
Component: Others (show other bugs) Others
Version: 8.4
Hardware: x86_64 Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: 刘小平
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-02 18:08 UTC by tearon
Modified: 2022-09-06 10:38 UTC (History)
1 user (show)

See Also:


Attachments
MariaDB服务状态 (241.47 KB, image/jpeg)
2022-06-02 18:08 UTC, tearon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tearon 2022-06-02 18:08:06 UTC
Created attachment 288 [details]
MariaDB服务状态

Description of problem:
在执行 podman run 带上 volume 挂载宿主机目录时,mariadb 直接不能启动了。而不带 volume 时,mariadb 就可以正常启动。

Version-Release number of selected component (if applicable):
anolis-8.4-x86_64-docker、anolis-8.6-x86_64-docker

How reproducible:
宿主机操作系统使用anolis-8.6-x86_64,然后在宿主机上分别执行下面的操作步骤。

Steps to Reproduce:
1.podman load -i anolis-8.6-x86_64-docker.tar
2.参考 https://hub.docker.com/r/openanolis/anolisos 制作 systemd 基础镜像的Dockerfile。内容如下:
FROM localhost/openanolis/anolisos:8.6-x86_64
ENV container docker
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]

3.podman build --format=docker --rm -t an8-systemd .

4.制作 MariaDB 镜像的 Dockerfile。内容如下:
FROM localhost/an8-systemd
RUN echo -e "[mariadb-server]\nname=MariaDB Server\nbaseurl=https://mirrors.aliyun.com/mariadb/yum/10.6/rhel8-amd64\ngpgkey=https://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB\nenabled=1" > /etc/yum.repos.d/MariaDB.repo; dnf -y install perl-DBI libaio libpmem rsync lsof boost-program-options socat openssl; dnf -y install --repo=mariadb-server MariaDB-server; dnf clean all; systemctl enable mariadb.service
VOLUME [/var/lib/mysql]
EXPOSE 3306
CMD ["/usr/sbin/init"]

5.podman build --format=docker --rm -t an8-systemd-mariadb .

6.mkdir -p /srv/mariadb/datadir

7.podman run -d --name mariadb -v /srv/mariadb/datadir:/var/lib/mysql -p 3306:3306 an8-systemd-mariadb /usr/sbin/init

8.podman exec -ti mariadb /bin/bash

9.systemctl status mariadb.service

Actual results:
Active: failed (Result: exit-code)

Expected results:
Active: active (running)

Additional info: