Skip to content

Latest commit

 

History

History
63 lines (55 loc) · 1.33 KB

example-wnm-docker-compose.md

File metadata and controls

63 lines (55 loc) · 1.33 KB

Wordpress - blog mit docker compose (Walkthrough)

mkdir wp 
cd wp 
# nano docker-compose.yml 
version: "3.7"

services:
    database:
        image: mysql:5.7
        volumes:
            - database_data:/var/lib/mysql
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: mypassword
            MYSQL_DATABASE: wordpress
            MYSQL_USER: wordpress
            MYSQL_PASSWORD: wordpress

    wordpress:
        image: wordpress:latest
        depends_on:
            - database
        ports:
            - 8080:80
        restart: always
        environment:
            WORDPRESS_DB_HOST: database:3306
            WORDPRESS_DB_USER: wordpress
            WORDPRESS_DB_PASSWORD: wordpress
        volumes:
            - wordpress_plugins:/var/www/html/wp-content/plugins
            - wordpress_themes:/var/www/html/wp-content/themes
            - wordpress_uploads:/var/www/html/wp-content/uploads
volumes:
    database_data:
    wordpress_plugins:
    wordpress_themes:
    wordpress_uploads:
# now start the system
docker compose up -d 
# we can do some test if db is reachable 
docker exec -it wp-wordpress-1 bash 
# within shell do 
apt update 
apt-get install -y telnet
# this should work 
telnet database 3306

# and we even have logs
docker compose logs 

# 
docker compose down