Page tree
Skip to end of metadata
Go to start of metadata

Somewhere between filesystem types, the fact that mac runs docker containers on a vm, and file ownership/permission issues - Mac has a hard time with development leveraging docker.

However, docker is a required tool in this day and age. The point of this article is to allow us to develop on the container files locally and see them reflected in near-real-time.

Assuming you have a data-only-container and the production container on same host/local machine

start the docker container with a volume mount from your Mac to the Container ( -v /mac/local/location:/temporary/dev/location/within/container). 

Example :

docker run -d -p 80:80/tcp -v /mac/local/location:/temporary/dev/location/within/container --volumes-from=data-only-container your-prod:image

in your docker container create a script to chown and sync /temporary/dev/location/within/container to /var/www/html/ (prod location within docker container)

In this example, my /temporary/dev/location/within/container is /tmp

run this with cron, make it exectuable, ensure cron and rsync installed.

add it to cron to sync every minute

Now edit files in /mac/local/location and see them live on the browser at port 80 from within container!

START CRON .....    service cron start

  • No labels
Write a comment…