WordPress
in a Docker containerYour content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.
WP Migrate Lite
WordPress extension to make a .zip file backup of the site and import it to Local.
Configure Vmmem cpu, memory, etc.
Example %USERPROFILE%\.wslconfig file
# Settings apply across all Linux distros running on WSL 2
[wsl2]
# Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB
memory=1GB
# Sets the VM to use two virtual processors
processors=2
# Sets amount of swap storage space to 8GB, default is 25% of available RAM
swap=0
Steps to create your multi-container Docker application:
- Create a folder (ex. wordpress-site). NOTE: the name of this folder will be used as the name of the Docker container.
- In the folder created above, create a file named docker-compose.yml and copy/paste the code below.
- Execute this command in that folder:
docker compose up -d
docker-compose.yml
# WordPress: Cloning your WordPress site locally using Docker Compose # https://fabianlee.org/2019/03/17/wordpress-cloning-your-wordpress-site-locally-using-docker-compose/ # # YouTube video: Quick WordPress Setup With Docker # https://youtu.be/pYhLEV-sRpY # # From the terminal, execute this following command: # docker-compose up -d version: '3' services: # Database db: image: mysql:5.7 volumes: - db_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: admin MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress networks: - wpsite # WordPress wordpress: depends_on: - db image: wordpress:latest ports: - 80:80 restart: always volumes: - wp_data:/var/www/html environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress networks: - wpsite networks: wpsite: volumes: db_data:
wp_data:
How to Backup and Share Docker Volumes
How to Backup WordPress Files and Database
UpdraftPlus Backup/Restore WordPress plugin
keywords: Docker, container, containers, WordPress, MySQL