There are several tutorials and files for running wordpress in docker. For me nearly none of them worked, therefore i wrote my own rerunable docker-compose file, which I like to share here now:
wordpress: image: wordpress container_name: wordpress links: - mysql ports: - "80:80" environment: WORDPRESS_DB_USER: root WORDPRESS_DB_NAME: wordpress WORDPRESS_DB_PASSWORD: "ch4ngeThis!" volumes: - /var/www/html/ mysql: image: library/mysql:latest mem_limit: 256m container_name: wordpress-mysql environment: - MYSQL_ROOT_PASSWORD=ch4ngeThis! - MYSQL_DATABASE=wordpress - MYSQL_USER=wordpress - MYSQL_PASSWORD=ch4ngeThis! volumes: - /var/lib/mysql
Just put this code into docker-compose.yml, change the passwords accordingly and run a new wordpress simply by:
docker-compose up