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

You might like also

Docker essential tools: Dive to navigate docker image content
If you want to explore the content of a docker image, Dive is THE tool for exploring a docker image, layer contents, and discovering ways to shrink the size of your Docker image. Note that we will be exploring the image not the container: viewing the container and the image are not the same thing. You can get most of the time a bash access to a running container with  docker run -it image_name sh Or following for images with an entrypoint docker …
41 Days ago
#ALPINE-HACK19 4 – 5 October, 2019
On October 4th and 5th, the AlpineHack19 will be held, a blockchain-themed hackathon. The opportunity to bring together software developers, hackers, information technology enthusiasts and SMEs to showcase their know-how. The aim for the participants is to develop a functioning open-source software or #hardware prototype – solutions that eliminate real problems, for real companies. #Blockchain Technology will be the center of all predefined challenges. 24 hours of #Innovation, personal development and lots of fun. I will be there as hackathon mentor …
150 Days ago
CryptoMountain Rocks in Sion 3-5 october 2019
CryptoMountain Rocks is a platform for Blockchainers from the Crypto Valley and beyond that offers a very inter-active conference with presentations, panels and talks battles. I will be there 3 days as a speaker and hackathon mentor. The event discusses latest Blockchain applications and talks about the impact of the new token economy on the way we do business. In parallel there will be the first CryptoMountain Rocks #ALPINE-HACK19 covering themes such as Agriculture, Energy and Supply Chain. …
150 Days ago
A git workflow that is easy and scale for product development
There are numerous GIT workflow floating around like Centralized Workflow, Gitflow, Forking flow and Feature Branch Workflow Over the last 10 years, I have followed this really simple workflow, similar to the forking flow. it allow Parallel Development, features branches can be merged to any release branches or ideally Master Collaboration Feature branches also make it easier for two or more developers to collaborate on the same feature We consider Master the stable version of the product, this branch should be deployed automatically using …
174 Days ago
Using free Cloudflare for CDN and DDoS protection
Cloudflare, Inc. is an American web infrastructure and website security company, providing content delivery network services, DDoS mitigation, Internet security, and distributed domain name server services.  It will cost you 0$ (DDOS, CDN) to 20$ or more and offer you the following advantages DDoS is short for Distributed Denial of Service. DDoSis a type of DOS attack where multiple compromised systems, which are often infected with a Trojan, are used to target a single system causing a Denial of Service …
174 Days ago
Add Docker container logs in Splunk
With Splunk You will be able to optimize container usage by monitoring CPU, memory, disk and network performance metrics from your containers. Pay only for what you need by managing resources and measuring the impact on service reliability and container resource requirements. Get a complete overview of Kubernetes and OpenShift Environments Correlate performance metrics, container logs and OpenShift/Kubernetes configuration and metadata for a better understanding of how your infrastructure is performing and how hosted applications are behaving. …
174 Days ago
Installing latest Splunk in 5 minutes using Docker
From 0 to Splunk in 5 minutes using Docker and Compose Splunk is an American multinational corporation headquartered in San Francisco, California, which produces software for searching, monitoring, and analyzing machine-generated big data, via a web-style interface. Docker is an open source software platform to create, deploy and manage virtualized application containers on a common operating system (OS), with an ecosystem of allied tools.  Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application's services. Then, with …
174 Days ago
Explore 142 Initial Exchange Offering  (IEO) by category, year and country
IEO is currently the most popular fundraising trend in the crypto industry. As the name suggests, Initial Exchange Offering is conducted over the crypto trading platform and exchanges. So unlike ICOs wherein crypto projects directly approach investors, IEOs involve a third-party in the form of crypto exchanges. …
268 Days ago
Security Token Offering (STO) statistics
Security token offering (STO) is a type of fundraising that is performed with a company offering tokenized securities. The defining feature of security token offerings is in its definition. Stocks, bonds and managed property trusts are another examples of securities. …
269 Days ago
systematization of knowledge within major blockchain protocols or consensus
Alexis Gauba presented a systematization of knowledge within major blockchain protocols or consensus, addresses the common challenges …
347 Days ago