This posting will deal with using Docker on the developer desktop. I will not talk about deploying these containers to other stages of the track to production. Maybe this is a topic for a follow-up by me or by someone who is more apt with all things devops.
All this started when I realized, that docker-compose.yml needs an absolute path on the host for its shared volumes. This is OK but when you would like to have multiple development setups for multiple projects. What I wanted was a single config file to rule a complete set of Dockerfile and docker-compose.yml files. And a comandline tool to manage that environment without the need to juggle around with several other tools and numerous options and flags.
An intermediary state consisted of a Makefile with several shell scripts for all the stuff that was hard to do in Makefiles. It worked but was a bunch of files. I wanted something cleaner with more possibilities for the future and fewer helper files.
So here it is: a Python file to rule them all (sorry for the pun …) and build Dockerfile and docker-compose.yml from templates and a config.yml file when booting up the environment. The repository is here: https://github.com/vgoebbels/docker-php7
What you get
- An Apache running PHP7.1 on http://localhost with document root (/var/www/html) as a shared volume in the www subdirectory
- A MySQL database connected to that PHP container
- A PHPMyAdmin listening on http://localhost:8080
- Check out from the Github repo above. Don’t mind the actual path to your environment. This will be determined and inserted into the docker-compose.yml file by the Python script.
- Install the required Python modules with
Shell1pip install -r requirements.txt
- Have a look at the templates in the templates subfolder
- Edit the configuration options in config.yml
- Boot the setup using
- Have a look at the running containers with
What doesn’t work yet
Using ./dockshell sshweb and ./dockshell sshsql to log into the running containers. Was not able to enter interactive mode. You will have to use:
docker container exec -it <CONTAINERNAME_HERE> /bin/bash
- ./dockshell clean removes all containers and images. And I mean all of them. This needs to be fixed!