Get ride of Vmware and move to Docker, how to properly setup the Dockerfile or the cointainer? -


i php developer of time test application working on is:

  • create vmware vm , install complete os: of time use centos
  • setup on vm meaning: apache , modules, php , modules , mysql or mariadb

anytime start new vm scratch there few steps run:

# install epel , remi repos wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm rpm -uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm  # install apache, php , dependencies yum -y install php php-common php-cli php-fpm php-gd php-intl php-mbstring php-mcrypt php-opcache php-pdo php-pear php-pecl-apcu php-imagick php-pecl-xdebug php-pgsql php-xml php-mysqlnd php-pecl-zip php-process php-soap  # start apache on 235 run level chkconfig --levels 235 httpd on  # setup mariadb repos nano /etc/yum.repos.d/mariadb.repo  # write inside 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  # install mariadb yum -y install mariadb mariadb-server  # start service service mysql start  # start mariadb on run level 235 chkconfig --levels 235 mysql on  # setup mariadb (this interactive) /usr/bin/mysql_secure_installation  # few more steps 

this annoying task , need time (when mess vm trying new things , changing here , there. here docker, think, comes save. after read few know basic of docker , have pull centos image running docker run -it centos that's bash shell , basic centos image task install & setup everything.

here doubts docker , how handle repetitive , common tasks:

  • should create dockerfile (this first dockerfile perhaps order not right or complete mistaken) content below , put repetitive tasks inside run-setup.sh file?

    from centos:latest maintainer myname <myemail>  run yum -y update && yum clean  add run-setup.sh /run-setup.sh run chmod -v +x /run-setup.sh  cmd ["/run-setup.sh"]  expose 80 
  • should run repetitive tasks hand before on vm?

  • the command /usr/bin/mysql_secure_installation complete interactive since need answer few questions , set password, how deal 1 or other interactive?
  • any better idea?

i start answering questions:

  • yes, start dockerfile. however, recommend using commands straight file easier maintain in future. e.g. dockerfile of apache github.

  • repetitive tasks, no. save images of containers pushing images public registry docker hub or host private one can docker container itself.

  • inter activeness should worked around somehow command line options, bash read or passing file if possible etc. not think there straight answer this.

  • better ideas, usual pattern host dockerfile in github or bitbucket public repository , configure automated builds against docker hub. come free :)

there many live working examples docker hub. start searching image, choose popular/offical one, must have links dockerfile.

let me know how goes.


Comments