Answers for "mariadb docker-compose"

SQL
3

mysql docker compose

version: 'X.X'
	services:  
    	db:    
        	image: mysql
            restart: always    
            environment:      
            	MYSQL_DATABASE: 'db' # So you don't have to use root, but you can if you like      
                MYSQL_USER: 'user' # You can use whatever password you like      
                MYSQL_PASSWORD: 'password' # Password for root access      
                MYSQL_ROOT_PASSWORD: 'password'    
           	ports: # <Port exposed> : < MySQL Port running inside container>      
             - '3306:3306'    
           	expose: # Opens port 3306 on the container      
             - '3306' # Where our data will be persisted    
           	volumes:      
             - my-db:/var/lib/mysql # Names our volume
           		volumes:  
           		y-db:
Posted by: Guest on March-22-2021
0

wordpress mariadb docker compose

version: '3.6'
services:

  wordpress:
    image: wordpress:${WORDPRESS_VERSION:-latest}
    container_name: ${COMPOSE_PROJECT_NAME:-wordpress}
    volumes:
      - ./config/php.conf.ini:/usr/local/etc/php/conf.d/php.ini
      - ${WORDPRESS_DATA_DIR:-./wordpress}:/var/www/html
    environment:
      - WORDPRESS_DB_NAME=${COMPOSE_PROJECT_NAME:-wordpress}
      - WORDPRESS_TABLE_PREFIX=${WORDPRESS_TABLE_PREFIX:-wp_}
      - WORDPRESS_DB_HOST=${WORDPRESS_DB_HOST:-mysql}
      - WORDPRESS_DB_USER=${DATABASE_USER:-root}
      - WORDPRESS_DB_PASSWORD=${DATABASE_PASSWORD:-password}
    depends_on:
      - mysql
      - phpmyadmin
    restart: always
    ports:
        - 80:80

  mysql:
    image: mariadb:${MARIADB_VERSION:-latest}
    container_name: ${COMPOSE_PROJECT_NAME}_mysql
    volumes:
      - ./mysql:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=${DATABASE_PASSWORD:-password}
      - MYSQL_USER=${DATABASE_USER:-root}
      - MYSQL_PASSWORD=${DATABASE_PASSWORD:-password}
      - MYSQL_DATABASE=${COMPOSE_PROJECT_NAME:-wordpress}
    restart: always

  phpmyadmin:
    depends_on:
      - mysql
    image: phpmyadmin/phpmyadmin:${PHPMYADMIN_VERSION:-latest}
    container_name: ${COMPOSE_PROJECT_NAME}_phpmyadmin
    restart: always
    ports:
      - ${PHPMYADMIN_PORT}:80
    environment:
      PMA_HOST: mysql
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-password}

  # Command line interface to wordpress
  wpcli:
    build: ./wpcli/
    image: wpcli
    container_name: ${COMPOSE_PROJECT_NAME}_wpcli
    volumes:
      - ${WORDPRESS_DATA_DIR:-./wordpress}:/var/www/html
    working_dir: /var/www/html

# Check availability of essential services
  healthcheck:
    image: wpcli
    build: ./wpcli/
    container_name: ${COMPOSE_PROJECT_NAME}_healthcheck
    command: sh -c "/wait"
    environment:
      - WAIT_HOSTS=mysql:3306, wordpress:80
      - WAIT_BEFORE_HOSTS=${WAIT_BEFORE_HOSTS:-30}
      - WAIT_AFTER_HOSTS=${WAIT_AFTER_HOSTS:-15}
      - WAIT_HOSTS_TIMEOUT=${WAIT_HOSTS_TIMEOUT:-300}
      - WAIT_SLEEP_INTERVAL=${WAIT_SLEEP_INTERVAL:-30}
      - WAIT_HOST_CONNECT_TIMEOUT=${WAIT_HOST_CONNECT_TIMEOUT:-30}
Posted by: Guest on September-27-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language