Learning about Docker Contexts
A single Docker CLI to rule them all! Let me show you a little example of how I manage different Docker nodes.
My audio search engine, Voilib is running on a remote machine,
configured in my .ssh/config file with the name voilib. I used to do
ssh voilib to open a new SSH session to execute commands such as
docker stats or docker logs. But then I discovered Docker Contexts.
I created a new context just by doing:
docker context create voilib --docker "host=ssh://voilib"
Now, every time I need to run any Docker command in the voilib machine I just do:
docker context use voilib.
From that moment, all the Docker commands such as docker exec, docker
logs or docker stats will be running inside the remote server! When I
want to return to my local environment I do:
docker context use default
I even opened a new PR in docker.el so that I can check available
contexts and change the active one from Emacs. How I wish I had
discovered it before!