Docker has shot to popularity in recent years for its ability to deliver OS-level virtualization for software by holding processes in separate 'containers'. The lack of full hardware emulation makes it lighter than a traditional VM, so much so that software engineers can host over five times the instances, with portability to boot. If you’re reading this, you probably have an idea of what you need it for already, so we will instead jump right into installing Docker Compose on Ubuntu 20.04.
First, though some pre-requisites. You’ll need the following:
- An Ubuntu 20.04 to install Docker on, either local or on a VPS
- Your VPS credentials, which can be found in your hosts’ control panel
- A method to connect to the VPS, such as PuTTY
- Sudo user access on the machine
Once everything is in place, you’ll want to connect to your VPS by entering its IP address in PuTTY’s ‘Host Name’ field and clicking open.
When prompted, type the username and password and press Enter to connect to the Linux environment.
Now we can get started on the Ubuntu 20.20 Docker Compose installation. For the unfamiliar, Compose lets you configure all of your application’s service via a YAML file and run them with a single command. To grab it and install it type:
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
We now need to change some permissions around so that we can execute the docker-compose command. We’ll use chmod for this as is standard:
sudo chmod +x /usr/local/bin/docker-compose
Issues can occasionally happen during install without an error being thrown up. We can make sure everything went smoothly with:
If you’ve done every correctly, the command-line will spit out your version and build number, which should look something like this:
docker-compose version 1.26.0, build d4451659
You can now move into any other configuration that is required, including setting up .yml files.