Centos7 as a Docker basic mirroring notice

Source: Internet
Author: User
Tags redis centos docker hub install redis
Centos7 the underlying mirror dockerfile to build a MySQL mirror may be problematic, build on the Docker hub failed: Built failed:the command '/bin/sh-c/etc/init.d/mysqld start & amp;& MYSQL-E "Grant all privileges on *.* to ' root ' @ '% ' identified under ' 123456 ' with Grant OPTION;" && MYSQL-E "Grant all privileges on *.* to ' root ' @ ' localhost ' identified by ' 123456 ' with Grant OPTION;" && mysql-u root-p123456-e "show databases;" ' returned a Non-zero code:127


The dockerfile used are as follows: # based on CENTOS7 base mirroring from Centos:7 maintainer Chenyufeng "yufengcode@gmail.com" Workdir/home
# install MySQL using yum: RUN yum install-y mysql-server MySQL
# After the installation is complete, execute the following command. Configure user name password related information; run/etc/init.d/mysqld start &&\ mysql-e "grant all privileges on *.* to ' root ' @ '% ' identified By ' 123456 ' with Grant OPTION, ' && \ mysql-e ' Grant all privileges in *.* to ' root ' @ ' localhost ' identifie D by ' 123456 ' with GRANT OPTION, "&& mysql-u root-p123456-e" show databases; "&& LN-SNF/ usr/share/zoneinfo/$TZ/etc/localtime && echo $TZ >/etc/timezone && yum Clean all
# SET environment variable ENV TZ Asia/shanghai # mirrored 3306 ports; Expose 3306 # After the container starts, execute the following command to start MySQL; CMD ["/usr/bin/mysqld_safe"]


The same problem with CENTOS7 base mirroring for building Redis mirrors: Build failed:the command '/bin/sh-c makes && make install ' returned a Non-zero c ode:127


The dockerfile used are as follows: # based on CENTOS7 base mirroring from Centos:7 maintainer Chenyufeng "yufengcode@gmail.com"
Workdir/home
# install Redis RUN yum install-y wget gcc && rpm--rebuilddb && \ Yum install-y tar &&A mp \ wget http://download.redis.io/redis-stable.tar.gz && \ tar-xvzf redis-stable.tar.gz && MV Redis-stable/redis && \ rm-f redis-stable.tar.gz && \ Ln-snf/usr/share/zo neinfo/$TZ/etc/localtime && echo $TZ >/etc/timezone && yum Clean all
Workdir/home/redis
RUN make && make install
# Set the environment variable for the time zone ENV TZ Asia/shanghai
# switch working directory to/home Workdir/home
# Open Port Expose 6379
# execute the following command after starting the container entrypoint redis-server/home/redis/redis.conf
CMD ["Redis-server"]



Note that it is recommended to use CENTOS6 base mirroring, rather than centos6.7, because CENTOS6 will be constantly updated and more stable. Do not recommend the use of CENTOS7, there will be a lot of pits. So I chose to centos6 the best.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.