Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What would be a good docker webdev workflow?

Tags:

docker

People also ask

What is part of the Docker developer workflow?

They include the operating system, application code, runtime, system tools, system libraries, and so on. You are able to connect multiple Docker Containers together, such as a having a Node. js application in one container that is connected to a Redis database container.

Can I use Docker for Web development?

Containerizing your applications will not only make your deployment faster but also a lot easier. The gained portability and flexibility with containers is immense. As a web developer, you can supercharge your development environment using Docker.


  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/


I understand this post is over a year old at this time, but I have recently asked myself very similar questions and have several great answers to your questions.

  1. You can setup a MySQL docker instance and have data persist on a stateless data container, aka the data container does not need to be actively running

  2. Yes I would recommend having a separate instance for your web server and database. This is the power of Docker.

  3. Check out this repo I have been building. Basically it is as simple as make build & make run and you can have a web server and database container running locally.

  4. You use the -v argument when running the container for the first time, this will link a specific folder on the container to the host running the container.

  5. I think your ideas are great and it is currently possible to achieve all that you are asking.

Here is a turn key solution achieving all of the needs you have listed.


I've put together an easy to use docker compose setup that should match your development workflow requirements.

https://github.com/ehyland/docker-silverstripe-dev

Main Features

  • Persistent DB
  • Your choice of HHVM + NGINX or Apache2 + PHP5
  • Debug and set breakpoints with xDebug

The README.md should be clear enough to get you started.