Docker Community Forums

Share and learn in the Docker community.

How do I implement a web server e.g. live-server in Docker for Wordpress

How would I go about implementing a web server within my Wordpress container in particular live-server.

Please see below my yaml file.

version: '3'

services:
    #######  Database service  #######
    mysqlDBserv:
        image: mysql:latest
        command: --default-authentication-plugin=mysql_native_password
        container_name: mysqlCont
        volumes:
            # - db_data:/var/lib/mysql
            # ....or use below
            - ./mysql:/var/lib/mysql
        restart: always
        environment: 
            MYSQL_ROOT_PASSWORD: root
            MYSQL_DATABASE: wpDB
            MYSQL_USER: admin   
            MYSQL_PASSWORD: pass


    #######  Wordpress service  #######
    wordpress:
        image: wordpress:latest
        container_name: wpCont
        depends_on:
             - mysqlDBserv
        restart: always
        environment:
            # the host is looking for the IP address & host or you can just use the service name
            WORDPRESS_DB_HOST: mysqlDBserv
            WORDPRESS_DB_NAME: wpDB
            WORDPRESS_DB_USER: admin
            WORDPRESS_DB_PASSWORD: pass
        ports:
            # Apparently this is for http connections
            - '8001:80'
            # Apparently this is for https connections
            # - '443:443'
        # All the relevant data lives at :/var/www/html
        volumes:
            # - wp_data:/var/www/html
            # ....or use below            
            - ./wordpress:/var/www/html


    #######  phpmyadmin service  #######
    phpmyadmin:
        image: phpmyadmin/phpmyadmin
        container_name: phpCont
        depends_on: 
            - mysqlDBserv
        restart: always
        ports:
            - '8002:80'
        environment:
            PMA_HOST: mysqlDBserv
            MYSQL_ROOT_PASSWORD: root