Demo: Deploying Simple Micsoservices With Docker Compose

- Create the project directory
#mkdir simple-wordpress

-Install docker compose
#yum -y install docker-compose

-Create the following compose file as "docker-compose.yml"
version: '2'   ---> compose file format version

services:   ---> defining one or multiple services definition
  db:
      image: mysql:5.7  ---> image to be run by the service
      volumes:
        - db_data: var/lib/mysql --> volume to be used by services
      restart: always
      environment:
           MYSQL_ROOT_PASSWORD: somewordpress
           MYSQL_DATABASE: wordpress
           MYSQL_USER:    wordpress
           MYSQL_PASSWORD: wordpress
  web:       --->service name
       depends_on:
          -db
       image: wordpress:latest       
       restart: always
       ports:    --> expose ports to the host
           - "8000:80"
      environment:
           WORDPRESS_DB_HOST: db:3306
           WORDPRESS_DB_HOST: wordpress
           WORDPRESS_DB_PASSWORD: wordpress

volumes:
        db_data:                  ---> Create volume to be used by one or multiple services


-Build the project, on the project directory run:
#docker compose up -d


if you want to stop
#docker-compose down

Bu blogdaki popüler yayınlar

SDLC - Software Development Life Cycle

@SerializedName and @Expose annotations