Lim Guan Ji
Posted on January 2, 2021
My latest obsession has been self-hosting ever since getting my Raspberry PI, I've began exploring docker compose files and setting them up.
One of the useful resources that I look for to do self-hosting is from
https://hub.docker.com/
One of the amazing things about docker is the folder structure, here I can specify my own directory, making docker generate the files at the mention directories.
Note that this docker compose is for raspberry pi setup, however it should also work for x86 systems as well.
version: '3.1'
services:
wordpress:
container_name: wordpress
image: wordpress
restart: always
ports:
- 9005:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: exampleuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_DB_NAME: exampledb
volumes:
- wordpress:/var/www/html
db:
image: mysql/mysql-server:latest
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- db/var/lib/mysql
volumes:
wordpress: /opt/containers/wordpress/html #Define your own path
db: /opt/containers/wordpress/mysql #Define your own path
💖 💪 🙅 🚩
Lim Guan Ji
Posted on January 2, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.