Docker Community Forums

Share and learn in the Docker community.

WordPress Container incl. FTP and PhpMyAdmin


(Ctuxboy) #1

Hello,

Docker is new for me.
I’m a webdesigner and developing WordPress websites.
Set my first steps buidling a docker container on my Qnap NAS with Container Station.

I create with succes a new container with the wizard in Container Station:

version: '3'

services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: somewordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "10084:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
volumes:
    db_data:

My question: how can i adding ftp-access and PhpMyAdmin to this container?


(Ctuxboy) #2

For phpmyadmin, adding this code (see below):

version: '3'

services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: somewordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "10085:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3307
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress

adding phpmyadmin

  phpmyadmin:
        image: phpmyadmin/phpmyadmin
        links: 
            - db:db
        ports:
            - 8000:80
        environment:
            MYSQL_USER: wordpress
            MYSQL_PASSWORD: wordpress
            MYSQL_ROOT_PASSWORD: somewordpress
volumes:
    db_data:

But doesn’t work :frowning:


(Ctuxboy) #3

Okay, one step closer for a solution.
Find this topic an dthis works well for phpmyadmin:


(Nxtra) #4

Don’t forget to include a volume to persist the html folder of your wordpress:

 wordpress:
 depends_on:
   - db
 image: wordpress:latest
 ports:
   - "10085:80"
 restart: always
 environment:
   WORDPRESS_DB_HOST: db:3307
   WORDPRESS_DB_USER: wordpress
   WORDPRESS_DB_PASSWORD: wordpress
volumes:
  - ./html:/var/www/html

The above will create a volume in your current directory where you will find your wp-content folder.
If not persisted you will lose your theme, images in posts… when you restart docker-compose.


(Ctuxboy) #5

Hi nxtra,

Thanks for the help and useful info.
I will try this.

I try using Docker in Container Station on my Qnap NAS (https://www.qnap.com/solution/container_station/en-us/)
The only problem that i have, i found enough tutorials how install Docker on Win10, OSX and Linux, but not for a NAS. I don’t know how link a volume to a directory on my NAS :-/