Notes

  • A Docker image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings. Available for both Linux and Windows based apps, containerized software will always run the same, regardless of the environment. Containers isolate software from its surroundings, for example differences between development and staging environments and help reduce conflicts between teams running different software on the same infrastructure.
  • A container is a runtime instance of an image—what the image becomes in memory when actually executed. It runs completely isolated from the host environment by default, only accessing host files and ports if configured to do so. Container are stateless and should be considered read only! (you can go inside the container change data, but at container creation your changes are lost)
  • Both MYSQL (Data, users) and Wordpress (plugins, themes, uploads) are stateful, so we have to use Docker volume to persist data across container restart.
  • expose: 3306 will let you connect later with MySQLWorbench to the port from outside of the container. it is optional.
  • depends_on tell wordpress to wait till mysql db container is up
  • The always restart policy tells Docker to restart the container under every circumstance. What’s great about the always restart policy is that even if our Docker host was to crash on boot, the Docker service will restart our container.
We will be using the official Wordpress image from Docker HUB But first let's create a file uploads.ini to avoid issues later on while uploading plugins in wordpress.

file_uploads = On
memory_limit = 256M
upload_max_filesize = 256M
post_max_size = 300M
max_execution_time = 600
Create a new file docker-compose.yml, adapt values to your liking, especially all passwords and username. Note that MYSQL and Worpress data are persisted OUTSIDE of container.

version: '2'

services:
  wordpress:
    depends_on:
       - db
    image: wordpress:latest
    volumes:
     - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
     - ./file-wordpress:/var/www/html
    ports:
      - 80:80
      - 443:443
    restart: always
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpress
      WORDPRESS_TABLE_PREFIX: abcd
  db:
    image: mysql:5.7
    volumes:
      - ./db-wordpress:/var/lib/mysql
    restart: always
    expose:
      - "3306"
    environment:
      MYSQL_ROOT_PASSWORD: wordpress
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress

The docker-compose up command aggregates the output of each container. It Builds, (re)creates, starts, and attaches to containers for a service. When the command exits, all containers are stopped. Running docker-compose up -d starts the containers in the background and leaves them running. To start Wordpress in the background

docker-compose up -d
To find the name of the container
docker ps -a
or
docker-compose ps
To read the logs file
docker logs wordpress
docker logs db
To go inside the container (remember all changes in there are lost at container restart)
docker exec -it wordpress bash
To delete all volume
docker-compose  rm -v
comments powered by Disqus

You might like also

Evaluating Blockchain Projects With Token Economy Canvas
Business Model Canvas is a strategic management and lean startup template for developing new or documenting existing business models. It is a visual chart with elements describing a firm's or product's value proposition, infrastructure, customers, and finances. It assists firms in aligning their activities by illustrating potential trade-offs. Business Model Canvas: nine business model building blocks, Osterwalder, Pigneur & al. 2010 After reading this great article https://medium.com/@pstehlik/evaluating-blockchain-projects-with-token-economy-canvas-908bc1bab6 I felt the need to create an online editor. "Token Economy Canvas consists of …
24 Days ago
ICO friendliness rating index
Do you want to relocate your Blockchain company to an ICO friendly country? the ICO friendliness rating index is a interactive way to go through the list of countries that are hostile or favorable to ICO and Cryptocurrencies. Attention! a disclaimer is required: No Legal Advice or Attorney-Client Relationship: This chart is provided for informational purposes only and is not legal advice. This information is not intended to create, and receipt of it does not constitute, an attorney-client relationship. Recipient should …
24 Days ago
Joomla 3.8.7 and WTLib WinNMP 18.03
As always updating to the latest version of all your developement components is never without any issues, here is what  you need to take into consideration when upgrading Joomla 3.8.7 and WinNMP 18.03 Install WinNMp 18.03 from https://winnmp.wtriple.com/ in any directory, default is C:\WinNMP\ Unpack Joomla 3.8.7 to C:\WinNMP\WWW\dev for example When starting WinNMP, you can click reload, to see the site appearing    Now edit Nginx virtual server    And cut and paste the following config (you can get it from http://winnmp.wtriple.com/nginx.phpJoomla-Nginx-configuration)   …
51 Days ago
The cryptocurrency hack of Bob
Bob did a lot of (obvious) mistakes, but you will still be able to learn a lot by going through this mindmap. The names have been changed to protect the innocent. Hack of Bob   …
80 Days ago
Dilbert about blockchain
compilation of the famous dilbert.com about Blockchain and Bitcoin   …
80 Days ago
coin360.io current market capitalization of all main cryptocurrencies
Coin360.io • Market State • Coins and tokens • 1 day performance • Market cap Coin360.io is an online platform with the latest data on the situation on the cryptocurrency market with the indication of the current market capitalization of all main cryptocurrencies. The service was launched in 2017 by the resource Cointelegraph.com.The information about the cryptocurrency market capitalization is visualized by Coin360.io with the use of the brick diagram or tree-like map. Such visualization form allows seeing the total …
87 Days ago
All blockchain companies in Zug - Switzerland
The Swiss blockchain ecosystem, also known as the Crypto Valley, is home to a growing number of startups, service providers and other organizations. Powered bv https://cryptovalley.directory …
89 Days ago
All blockchain companies in Switzerland
Powered bv https://cryptovalley.directory …
89 Days ago
But what *is* a Neural Network? part 2
Neural Networks Demystified [Part 1: Data and Architecture] Neural Networks Demystified [Part 2: Forward Propagation] Neural Networks Demystified [Part 3: Gradient Descent] Neural Networks Demystified [Part 4: Backpropagation] Neural Networks Demystified [Part 5: Numerical Gradient Checking] Neural Networks Demystified [Part 6: Training] Neural Networks Demystified [Part 7: Overfitting, Testing, and Regularization] …
94 Days ago
But what *is* a Neural Network?
Here are the best video i've found on the subject. Moreover this channel is among the best also for learning mathematical concept in a very didactic way! Chapter 1, deep learning Gradient descent, how neural networks learn What is backpropagation really doing? Backpropagation calculus …
94 Days ago