No Docker Compose. Now what?
I have had used Docker Compose from the begging of my Docker journey. I had a great time to simplify what I create with containers. I’m sad to say this but it left some bad taste in mouth.
Actually, it’s tasteless anymore. I see no point of installing and running Docker Compose just for a PostgreSQL or a Redis servers1.
I’ve had a chance to run CentOS 8 as workstation for a month. To be real, it was
a real challange to obey the rules of SELinux. Podman was really helpful tool to
run in rootless mode2 inside that craziness. The second minute I thought I
can work without Docker Compose. I just couldn’t I have looked around for Docker
Compose for Podman which webloggers introduction Podman as simple as
alias docker=podman
. No, it is not!
You might ask somebody should have done something. Indeed, they did but I really
didn’t want to spend so much time to run Compose-ish containers. I admitied
not have a docker-compose.yaml
anymore.
Kernel Virtual Machine and libvirt
I know so many people who will start to write “why would you replace a container with a virtual machine? (all in caps)” I have reasons of mine. Give me some of your vaulable time to explain.
The experience of managing racks of servers tought me something: keeping things simple. To be honest, you can replace that sentence with anything you want. Like any other fields, we need to keep mental overhead low. I already moved development tools (compilers, make) from the host to Vagrant machines. The last things was Docker.
I came a cross with the provisioner for Docker in Vagrant. In my mind, I was asking can I make Vagrant…
Where this idea come from? Actually it was from cloud IDE/development tools. I found I feel confident when somebody, an administrator in this case, gives everything a developer needs in a toolbox. Vagrant has been used just for this reason but had forgotten. I am not here to rescue it from that status but I’m happy to use the tool where I can run it whenever I need.
Vagrant.configure('2') do |config|
# ...
config.vm.provision :docker do |container|
container.run 'postgres', image: 'docker.io/postgres:11', args: %w[
--env POSTGRES_USER=patato
--env POSTGRES_PASSWORD=patato
--env POSTGRES_DB=patato_development
-p 5432:5432
].join(' ')
end
end
To long; didn’t read but curious about the content
We often skip this part for the simplicity of running a simple, single snippet or a command. Knowing the internals of development environment is also important. However, more important then that is reproducibility. If a new developer spends an hour to figure out how to install Docker engine, then there is a problem.
I use Vagrant to provision my development environment. As a developer, I don’t want to follow a Markdown document to prepare the enviornment. As an administrator, I really don’t want to write script to do the black magic.
I might need to add aditional posts to give examples of how I work to make this post more clearer.
Too long; didn’t read
Use Vagrant with Docker provisioner.