sclorg / mysql-container

MySQL container images based on Red Hat Software Collections and intended for OpenShift and general usage. Users can choose between Red Hat Enterprise Linux, Fedora, and CentOS based images.
http://softwarecollections.org
Apache License 2.0
128 stars 201 forks source link

centos/mysql-57-centos7:latest - CentOS Root access? #296

Open Pasayadaan opened 3 years ago

Pasayadaan commented 3 years ago

Using Centos/mysql-57-centos7 how can we get root access for centos to install additional components such as Percona Xtrabackup or to execute shell script.

It throws error "Permission denied"

hhorak commented 3 years ago

You can either run the container as root:

docker -u 0 <other args> centos/mysql-57-centos7

but that might not work easily, because mysqld process rejects to run as root from security reasons.

So, I'd rather advice to build your own image using this Dockerfile and docker build .:

FROM centos/mysql-57-centos7
USER 0
RUN yum -y install ... && yum clean all
USER 27