My Docker / docker-compose Notes

Hits: 159

content is updated continuously.

Useful commands for daily use:
Build Docker: docker-compose build
Run in background : docker-compose up -d
Follow Docker Logs: docker-compose logs -f containerid
Get Bash/SSH into a running Container: docker exec -it containerid bash

Remove all stopped containers: docker rm $(docker ps -a -q)

Docker for Local WordPress Development

Hits: 216

Create a file  called docker-compose.yml with the following code in your project directory and then enter ‘docker-compose up’ at the command line.

version: "2"
services:
  my-wpdb:
    image: mariadb
    ports:
      - "8081:3306"
    environment:
      MYSQL_ROOT_PASSWORD: verysecret
  mywp:
    image: wordpress
    volumes:
      - ./:/var/www/html
    ports:
      - "8080:80"
    links:
      - my-wpdb:mysql
    environment:
      WORDPRESS_DB_PASSWORD: verysecret