What would be a good docker webdev workflow?

  1. If you need database persistance indepent of your CMS container, you can use one container for MySQL and one container for your CMS. In such case, you can have your MySQL container still running and your can redeploy your CMS as often as you want independently.

    For development - the another option is to map mysql data directories from your host/development machine using data volumes. This way you can manage data files for mysql (in docker) using git (on host) and "reload" initial state anytime you want (before starting mysql container).

  2. Yes, I think you should have a separate container for db.

  3. I am using just basic script:

    #!/bin/bash
    
    $JOB1 = (docker run ... /usr/sbin/mysqld)
    $JOB2 = (docker run ... /usr/sbin/apache2)
    echo MySql=$JOB1, Apache=$JOB2
    
  4. Yes, you can use data-volumes -v switch. I would use this for development. You can use read-only mounting, so no changes will be made to this directory if you want (your app should store data somewhere else anyway).

    docker run -v=/home/user/dev/cmsdir:/var/www/cmsdir:ro image /usr/sbin/apache2
    

    Anyway, for final deployment, I would build and image using dockerfile with ADD /home/user/dev/cmsdir /var/www/cmsdir

  5. I don't know :-)


You want to use docker-compose. Follow the tutorial here. Very simple. Seems to tick all your boxes.

https://docs.docker.com/compose/

Tags:

Docker