It’s been two days, roughly 12 hours real time getting spun up on a new project. The client requirements here means we must use Docker for our development environments. When I first heard this, I was seriously excited… docker, unit tests, standardization… who wouldn’t enjoy stability? Right?

Yesterday morning I began to setup docker on Windows 10. My first immediate thought is “download Docker” so I did… two hours into client documentation, I realized “Docker for Windows” required Windows 10 Pro – which explained why I had so many issues. So, after a few calls with my fellow peeps, I downloaded and installed Docker Toolbox, which is supposed to be for those of us who don’t have Windows 10 Pro.

Installation was pretty smooth, no bumps, no issues. Then came the composing of the docker environment… again. Apparently the mariadb image that is in use on the mysql service has an issue with Windows, period, not Windows 10, not 7, just… Windows! So, apparently if no tag is included on an image – it uses latest.

After about 2 hours of googling and trying solutions I came to find that mariadb:10.0.22 was supposedly the best fit here. So I updated the docker-compose file without a second thought, and boom… it booted up just fine. This is at least a few decent versions behind latest, but it worked, so I was stoked. “Great”, I thought, “I can start work now”. So I loaded up the WordPress and well… “Error establishing database connection…”

Two more hours went by troubleshooting this, even my peeps couldn’t figure out why the host wasn’t able to connect to the database. So…. this morning I made a rash decision to once again, lean on my dedicated Linux box. Today was filled with installing Docker, AWS cli, and many more gotchas you would expect when dealing with Ubuntu.

But, the question remained, how the hell am I supposed to code, make PRs, how do I even connect to the site? Well since my server is well… mine, I have full control — so after a pretty lengthy call with Justin ( a senior developer who has been though this already ), we setup an Nginx proxy to pass all requests to a specific top level domain over to docker.

upstream mysite{
        server 127.0.0.1:8000;
}

server {
        server_name *.dev;
        location / {
            proxy_redirect off;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Host $server_name;
            proxy_pass http://mysite$uri$is_args$args;
        }
}

So, that solved the connectivity issue, but how am I supposed to code and test it? Enter PHPStorm – while it’s not as straightforward as most setups, it still works; I just keep the repo locally, and push only changed files to the remote. This allows me to ensure there’s NO way for someone to commit to the client’s repo unless they have access to my personal computer.

It’s still unfortunate that Docker is not really the ONE solution so many make it out to be, especially for Windows! Admittedly it’s not Docker itself, that’s basically just a framework, maybe it was just the docker-compose, or maybe it was a slew of things. Either way… I’ll not be moving to Docker anytime soon – the Local by Flywheel peeps have this on lock so far, and I’ll be sticking with them for some time.

For the duration of this project, this setup will have to do!