WordPress development using Docker – how to share directories? [closed]

I wrote up a short tutorial in this other answer which goes into a little more detail, but I think you want to use docker-compose to define any directories (volumes) that you want to share between your local environment and the container environment. There may be a way to do this directly with Docker, but I think docker-compose is a useful tool for this.

Sample docker-compose.yml file:

wordpress:
  image: wordpress
  links:
    - db:mysql
  ports:
    - 8080:80
  volumes:
    - .:/var/www/html/wp-content/themes/my-theme-name

db:
  image: mariadb
  environment:
    MYSQL_ROOT_PASSWORD: example