Best way to install of docker-compose
Table of Contents
It’ happens a lot if you are using a docker-compose
tool for the development or deployment. What if you are on different machine that doesn’t have a docker-compose installed and you need this tool right away. How can you install docker-compose quickly and simply as possible?
tl;dr #
sudo wget -P /usr/local/bin/ \
https://github.com/docker/compose/releases/download/1.28.4/docker-compose-Linux-x86_64 \
&& sudo mv /usr/local/bin/docker-compose-Linux-x86_64 /usr/local/bin/docker-compose\
&& sudo chmod +x /usr/local/bin/docker-compose
Option 1: pip #
A simple no brain method to install a docker-compose
problem here is that - you need python3 + pip installed. And also using this method some linux ditros will install old docker-compose version. Then you get that annoying error lower version in docker-compose file to 3.3
.
There is way more better way to install it.
Option 2: curl (no dependency) #
This method has great advantege that you don’t have to install python3 or pip and you get the lastest version. All you need are tools all distros have alraedy have preinstalled. curl
Here is a quite long command:
sudo wget -P /usr/local/bin/ \
https://github.com/docker/compose/releases/download/1.28.4/docker-compose-Linux-x86_64 \
&& sudo mv /usr/local/bin/docker-compose-Linux-x86_64 /usr/local/bin/docker-compose\
&& sudo chmod +x /usr/local/bin/docker-compose
But that’s it you already have it done. As I said before this method problem is long unmemorable command so it’s nice you have to stored somewhere.
Oh and btw. If you use sudo usermod -aG docker $user
command and docker ps
is still not working for you then you can use: newgrp docker
.
Bonus: docker print #
What I also recommend better docker print where you can have much cleaner print. Edit config in path .docker/config
where you need to put:
{
"psFormat": "table {{.ID}}\t{{.Status}}\t{{.Names}}"
}
Which will result in such a nice clean output:
bf1e56aab271 Up 3 weeks web-server
efaf62aae85d Up 5 weeks nextcloud
454767aabe2b Up 5 weeks (healthy) cloudflared
fb1107aa2077 Up 5 weeks (healthy) pihole
Cheers