Is production: true
#migrated

Title: Install docker on CentOS

Created: 19 Mar 2023 Modified: 19 Mar 2023

Description:



[Legacy Link]

[Link to install docker]

[Link to install docker compose]

Instructions

Install docker

  1. Uninstall previous installed docker

    sudo yum remove docker \
                      docker-client \
                      docker-client-latest \
                      docker-common \
                      docker-latest \
                      docker-latest-logrotate \
                      docker-logrotate \
                      docker-engine
    
  2. Add repo to yum

    #If missing yum-config-manager install it by yum
    #sudo yum install yum-utils
    
    sudo yum-config-manager \
        --add-repo \
        https://download.docker.com/linux/centos/docker-ce.repo
    
  3. Install

    sudo yum install docker-ce docker-ce-cli containerd.io
    
  4. Start service

# If the service not auto started
systemctl start docker

Install docker compose

  1. Download stable version

    sudo curl -L "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    
  2. Modify permission

    sudo chmod +x /usr/local/bin/docker-compose
    
    # Incase the /usr/local/bin not included in bashrc
    # echo export PATH=$PATH:/usr/local/bin >> ~/.bashrc
    
  3. Test if the command works

    docker-compose
    # should show the command line interface
    # if command not found, please revise ~/.bashrc add /usr/local/bin to PATH