2

I normally use vagrant (VVV or bedrock flavours) for local WordPress development.

But I want to learn how to use Docker.

I've installed it with Boot2Docker, ran Docker and learned how to pull images or even start a Nginx WordPress container which successfully responded on my local host machine via http. The docs from Docker helped me with all that.

My problem is: I have not understood how to create containers for WordPress with a specific configuration (I prefer LEMP, I might want to experiment later with HHVM) and share the content of a container with my local host machine, and well, do the actual development.

I can't find where Docker stores files. With Vagrant it's more straightforward... And also, I store my projects in a Dropbox directory - which works for me as an additional backup and synchronization in case I want to access my local files elsewhere. Would like to achieve the same with Docker.

Has anyone written a tutorial for this? Or could you point to some doc I might have been missing?

From here https://docs.docker.com/userguide/dockervolumes/ I've read that

Note: If you are using Boot2Docker, your Docker daemon only has limited access to your OSX/Windows filesystem. Boot2Docker tries to auto-share your /Users (OSX) or C:\Users (Windows) directory - and so you can mount files or directories using docker run -v /Users/:/ ... (OSX) or docker run -v /c/Users/:/

On the Boot2Docker github readme I've found instead: https://github.com/boot2docker/boot2docker#folder-sharing

But that doesn't solve the issue. It seems it's read only? But apart from that, I'd like to share a directory inside dropbox, e.g. /dropbox/docker with my Docker projects/containers - a bit like I do with Vagrant. Any way to achieve that?

Thank you

closed as off-topic by Mark Kaplun, TheDeadMedic, Mayeenul Islam, kaiser May 10 '16 at 1:19

This question appears to be off-topic. The users who voted to close gave these specific reasons:

If this question can be reworded to fit the rules in the help center, please edit the question.

1

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.