I was trying to create a Docker Image for ProxySQL . Following is my DockerFile
FROM rhel7:latest
USER root
MAINTAINER Ques Zama
# Update the image with the latest packages (recommended)
RUN yum update -y; yum clean all
# Update image
RUN yum-config-manager --enable proxysql_repo
# Install ProxySQL
RUN yum install proxysql -y
# Expose ProxySQL Port 6034
EXPOSE 6034
# Start the service
CMD /etc/init.d/service start proxysql
I was trying to build the image with below command
sudo docker build --no-cache -t zama_proxysql .
But I can it is not able to install the proxysql
package using yum
command as mentioned in Dockerfile
. Following is the message below
Step 6 : RUN yum install proxysql -y
---> Running in 54cc1ae88ba3
Loaded plugins: ovl, product-id, search-disabled-repos, subscription-manager
No package proxysql available.
Error: Nothing to do
The command '/bin/sh -c yum install proxysql -y' returned a non-zero code: 1
If I execute the command yum install proxysql
in commandline , it works fine . But from Dockerfile
, it could not find the package. Please note that I have already enabled the repo for proxysql
in /etc/yum.repos.d
Any suggestions to resolve the issue
Try adding the repo manually first instead of using yum-config-manager :
cat <<EOF | tee /etc/yum.repos.d/proxysql.repo
[proxysql_repo]
name= ProxySQL YUM repository
baseurl=http://repo.proxysql.com/ProxySQL/proxysql-1.4.x/centos/\$releasever
gpgcheck=1
gpgkey=http://repo.proxysql.com/ProxySQL/repo_pub_key
EOF
This works properly on a FROM centos:7 image.