CMD : CMD command sets the initial command/script which will be called when our container is started. Expose 3306 : Exposing the MySQL port of the MySQL container to the host server.ġ0. RUN chmod +x run.sh : Setting the permissions for run.sh script to executable.ĩ. ADD run.sh / : Adding the run.sh script which will be our entry point script for initiating the configurations for MySQL container.Ĩ. Privateipofapachehost is the private IP of host server on which Apache container will be running.ħ. Grant all on wordpress.* to identified by ‘password’ ADD setup.sql / : This file contains DB and user settings which will be used by the Apache image to connect to MySQL container. RUN chmod +x mysql.sh : In this step we are setting up permissions for mysql.sh to executable.Ħ. This script contains post install configurations to be applied. ADD mysql.sh : Now, we are adding mysql.sh to the final container. The my.cnf is added to /etc/mysql/ location using the above command.Ĥ. Here we are providing our my.cnf to be used by MySQL instance. ADD: my.cnf /etc/mysql/ : ADD option adds the files required for configuration. MAINTAINER AS : This specifies the maintainer/creator of the images created by the above docker file.ģ. This image has MySQL installed on the container.Ģ. The “dockerttnd/mysqlinfra:2.0” image will be automatically downloaded. FROM : This specifies the base image from which the MySQL image will be built and further customized. MAINTAINER AS Support my.cnf /etc/mysql/ĭetails regarding the options used in above Dockerfile :-ġ. The Dockerfile used in this article is as below:. Here we will be using ~/docker/mysql for MySQL Dockerfile and ~/docker/apache for Apache Dockerfile. They do not require a specific path or folder structure to be followed. Dockerfile can be created on any location. Dockerfiles are the easiest way to configure images, which will be further used to create the containers. The containers will be created using Dockerfile. We will be using WordPress as the application on the LAMP stack. Both the MySQL and Apache docker containers will be hosted on different hosts. This blog post describes setting up LAMP stack using containers via docker on different servers.
0 Comments
Leave a Reply. |