• 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'

       - db
    image: wordpress:latest
     - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
     - ./file-wordpress:/var/www/html
      - 80:80
      - 443:443
    restart: always
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpress
    image: mysql:5.7
      - ./db-wordpress:/var/lib/mysql
    restart: always
      - "3306"
      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
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

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] …
4 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 …
4 Days ago
The Business Blockchain: Promise, Practice, and Application of the Next Internet Technology
The Business blockchain by William Mougayar is a good primer for understanding the potential impact of the block chain and a fantastic insight into the future applications of blockchain technology.  The intro, by Ethereum's founder, Vitalik Buterin, did a very good job at setting the picture up of how the blockchain is an inevitable byproduct of the times, created by a need for trust. William Mougayar does not go into specific short term ways of teaching you how to create value via the …
4 Days ago
Blockchain Crypto Valley Map
For the first time a comprehensive overview is available that shows the size, importance and diversity of the whole ecosystem in the Crypto Valley. lists more than 350 companies developing and using blockchain technologies The Swiss blockchain ecosystem, also known as the Crypto Valley, is home to a growing number of startups, service providers and other organizations. The Crypto Valley Map is a constantly updated database of these ecosystem contributors, provided for free. I was having lots of fun implementing …
4 Days ago
Jincor Targets to Bring Smart Contracts to 10,000 Businesses by the end of 2018
Even though everyone is talking about smart contracts and their advantages over traditional paper contracts, only a handful of people are addressing the elephant in the room: most of the businesses don’t know how to use smart contracts yet. Jincor is among those few who are trying to make smart contracts and other blockchain technologies more accessible to modern businesses. And anyone can chime in by joining the project’s public token sale, which starts today, on the 1st of December. Jincor is a …
96 Days ago
How to accept Bitcoin on a website using Electrum and Letsencrypt
This tutorial will show you how to accept Bitcoin on a website with SSL signed payment requests using Electrum, required is a shell access and enough permission to install electrum A webserver serving static HTML A SSL certificate (signed by a CA) Electrum version >= 2.6 Install dependencies: sudo apt-get install python3-setuptools python3-pyqt5 python3-pip Install Electrum: sudo pip3 install then run on your server electrum create electrum daemon start electrum setconfig ssl_privkey /etc/letsencrypt/live/ electrum setconfig ssl_chain /etc/letsencrypt/live/  electrum setconfig …
98 Days ago
Ethereum Solidity modern development environment
Here are the list of tips and tricks to develop solidity in a modern way (understand back to 2017 year :-) ) IDE Support I recommend you to use the excellent Jetbrains Webstorm or Intellij IDEA with the folllowing free plugins: Intellij-Solidity see Solidity Solhint Plugin allow to enable Solhint inspection capabilities in your project. It highlight of warnings / errors found by the linter in editor during code modification. Refactoring in Javascript is excellent but still not supported in …
113 Days ago
No Thumbnail was found
work in progress - daily update Feedback is welcome in comments section, or through my contact form click on map, to view in full size …
150 Days ago
How to: Securing your Crypto  Assets
work in progress - daily update - a more convenient online version is also hosted at  Pull requests are welcomed! Feedback is welcome in comments section, or through my contact form click on map, to view in full size …
150 Days ago
Big Bang Blockchain: La seconde révolution d'internet de Stéphane Loignon
La blockchain est annoncée comme une révolution technologique, économique, politique et sociétale aussi puissante qu’Internet. Cette « chaîne de blocs » promet d’être l’outil incontournable de demain. À quoi sert la blockchain ? Cette nouvelle technologie permet avant tout d’envoyer de l’argent en ligne sans intermédiaire : ni banque, ni compagnie de carte de crédit. Elle pourrait bouleverser la finance, l’assurance et le transfert d’argent tout en étant le moteur d’un vaste mouvement de décentralisation de l’économie numérique. Grâce à elle, certains rêvent …
168 Days ago