Write Content To File From Dockerfile And/or Any Other Method

Home » CentOS » Write Content To File From Dockerfile And/or Any Other Method
CentOS 3 Comments

I am building a Dockerfile and I am setting up MariaDB repos as follow:

# Setup MariaDB repos RUN touch /etc/yum.repos.d/MariaDB.repo

I should write this inside the MariaDB.repo file:
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/CentOS6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

What’s the right way to do this? The one below?

echo “[mariadb]” >> “/etc/yum.repos.d/MariaDB.repo”
echo “name = MariaDB” >> “/etc/yum.repos.d/MariaDB.repo”
echo “baseurl = http://yum.mariadb.org/5.5/CentOS6-amd64” >>
“/etc/yum.repos.d/MariaDB.repo”
echo “gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB” >>
“/etc/yum.repos.d/MariaDB.repo”
echo “gpgcheck=1” >> “/etc/yum.repos.d/MariaDB.repo”

3 thoughts on - Write Content To File From Dockerfile And/or Any Other Method

LEAVE A COMMENT