Let's set up docker...
Installation and setup of docker & docker-compose to a linux machine
Installation of docker, here we are assuming a Ubuntu machine.
P.S. There is a bash script at the end that does all of this, you can just run that as well
Let us first remove existing docker files if any are present in the system
sudo apt-get remove docker docker-engine docker.io
Now let's update our packages before we go ahead
sudo apt-get update
Now we are going to install docker.io
which is the Debian package for docker
sudo apt install docker.io
Depending on your machine's internet connection speed and other factors, this may take some time. After the installation is complete, you can run the command the following command to check if docker is running or not.
sudo docker ps -a
You might notice that you need to be a sudo to run this command, which can be a hindrance in the long run, so let's allow the user to run docker commands without using sudo, to do this run the following command
sudo usermod -aG docker $USER
replace $USER
with your username, please ensure that the user should be a sudoer
Now to install docker-compose
Download the latest stable release of the docker-compose standalone
curl -SL https://github.com/docker/compose/releases/download/v2.29.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
This can change over time so get the current version from https://docs.docker.com/compose/install/standalone/
Once downloaded, give executable permissions to the binary
sudo chmod +x /usr/local/bin/docker-compose
This should be it, test whether docker-compose is installed by running the below command
docker-compose --version
If this doesn't work, try to create a symbolic link to /usr/bin/
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
and that is it, you have successfully installed docker & docker-compose to your Linux system, enjoy dockerizing stuff
Bash Script
curl https://raw.githubusercontent.com/Kevin-Aaaquil/scripts/main/install_docker.sh -o install_docker.sh