In this tutorial, we’ll show how to install the latest version of Docker Compose to help you manage multi-container applications. We will run WordPress MySQL and phpMyAdmin with docker-compose YAML file.

What is docker-compose?
Docker is a great tool for automating the deployment of Linux applications inside software containers. To get the full advantage of docker we must run each component of an application run in its own individual container. For complex applications with lots of components, it can will become cumbersome to orchestrate all the containers to start, communicate, and stop simultaneously.

#wordpress #dockercompose #ubuntu #docker-compose

How to Install Docker in Ubuntu 21.04 Using Official Repository

Steps to install Docker-Compose
Docker Compose is a single binary file. The installation is straightforward. We’ll download the file to a directory that is in the system PATH and make it executable.
1. Run this command to download the current stable release of Docker Compose:
sudo curl -L ” -s)-$(uname -m)” -o /usr/local/bin/docker-compose
To install a different version of Compose, substitute [1.29.2] with the version of Compose you want to use.
2. Run this command to Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
3. To know the location of docker-compose installation. Run the command .
which docker-compose
4. Test the installation.
docker-compose –version
5. Uninstallation: –
That’s it! Docker Compose has been installed on your Ubuntu machine, and you can start using it.

What is YAML?
YAML is a data serialization language that is often used for writing configuration files. YAML stands for yet another markup language or YAML, which emphasizes that YAML is for data, not documents.
YAML is a popular programming language because it is human-readable and easy to understand.
What is YAML used for?
One of the most common uses for YAML is to create configuration files. It’s recommended that configuration files be written in YAML rather than JSON, even though they can be used interchangeably in most cases, because YAML has better readability and is more user-friendly.
YAML is also used by Docker-Compose and other automation tool like Ansible (to create automation processes), and Kubernetes (to create resources and deployments).

YAML Codes:

version: “3”
services:
mysql_db:
container_name: mysql_container
environment:
MYSQL_DATABASE: wordpress_db
MYSQL_PASSWORD: wordpress_user_password
MYSQL_ROOT_PASSWORD: password_of_your_choice
MYSQL_USER: wordpress_user
image: “mysql:5.7”
restart: always
volumes:
– “mysql:/var/lib/mysql”
wordpress:
container_name: wordpress_container
depends_on:
– mysql_db
environment:
WORDPRESS_DB_HOST: “mysql_db:3306”
WORDPRESS_DB_NAME: wordpress_db
WORDPRESS_DB_PASSWORD: wordpress_user_password
WORDPRESS_DB_USER: wordpress_user
image: “wordpress:latest”
ports:
– “8000:80”
restart: always
volumes:
– “./:/var/www/html”
volumes:
mysql: {}

Working with Docker Compose and WordPress.
• sudo docker-compose up
• WordPress is showing two minute wordpress installation window.
• Fill Site , Title , Username , Password . Check confirm use of Weak password , Enter Your Email , Then Click , Install WordPress.
• It will show you Installation , Success Screen.
• We logged in to wordpress dashboard.
• Look front end of wordpress website.
• Let’s look mysql reference for environment variable created in yaml file at dockerhub website .
• Similarly, Let’s look wordpress reference for environment variable created in yaml file at dockerhub website .
• We have engaged terminal by running docker compose command . Press Ctrl+C to release it.
• sudo docker-compose up -d
• docker ps
• sudo docker images
• sudo docker volume ls
#Run #WordPress #Website #Docker #Deploy #WordPress #Website #Docker #Compose

Leave a Comment

Your email address will not be published. Required fields are marked *