Install Docker & Docker Compose
Centos 7
RedHat
Step 1 — Install Docker6
Install needed packages:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Configure the docker-ce repo:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install docker-ce:
sudo yum install docker-ce
Add your user to the docker group with the following command.
sudo usermod -aG docker $(whoami)
Set Docker to start automatically at boot time:
sudo systemctl enable docker.service
Finally, start the Docker service:
sudo systemctl start docker.service
Step 2 — Install Docker Compose
Install Extra Packages for Enterprise Linux
sudo yum install epel-release
Install python-pip
sudo yum install -y python3-pip
python3 -m pip install -U pip
python3 -m pip install -U setuptools
Install correct pip version
sudo apt-get remove --purge python-pip
sudo apt-get autoremove
sudo rm -f /usr/local/bin/pip
sudo easy_install pip==20.3.4
pip --version
Then install Docker Compose:
sudo pip3 install docker-compose
You will also need to upgrade your Python packages on CentOS 7 to get docker-compose to run successfully:
sudo yum upgrade python*
To verify a successful Docker Compose installation, run:
docker-compose version
Mint
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
Next add Docker official key which is important in enabling Docker repo.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Adding Docker repository
Next thing is to add Docker repository to Linux Mint. The variable ‘$ (. /etc/os-release; echo “$ubuntu-codename”)’ ensures that you are using the right distribution of your Linux Mint
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(. /etc/os-release; echo "$UBUNTU_CODENAME") stable"
Update your system again
sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER
newgrp docker