Do Docker like an adult!
Stuart Burns is as mad as hell and he’s not going to stand for your shoddy Docker deployments any longer!
In the world of ephemeral services, Docker images provide a great way to have disposable I services on a ‘quick in, quick out’ scenario. With that ease of use, bad practice can creep in. Here we’re discussing some of the ways to optimise production usage of Docker in a single-host scenario.
While it is simple enough to just run Docker from the command line using various switches, you are missing a big time-saving trick. Replacing those command lines with Docker Compose and a YAML Docker config file is a much better way to achieve a consistent outcome. Using Docker Compose also cleans up after itself, removing resources when it is brought down, so it makes complete sense to use it.
Using a single Docker Compose file, you can include an entire software stack defined in one file that can be deployed, version-controlled and consistent. You could use a Bash script but it’s not the ’90s any more. You do, however, need to install the Docker Compose tool to use it. For example, in Ubuntu, it’s as simple as: $ sudo apt install -y docker-compose