Quick start to install Docker and Docker-compose on Linux

CentOS

# (optional) remove old
sudo yum remove -y docker \
                  docker-ce-cli \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine
                  
# Docker              
sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2
  
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
    
sudo yum install -y docker-ce


sudo systemctl start docker
sudo systemctl enable docker  # start docker at boot up

# (optional) Verify
sudo docker run hello-world


--------------------------FAQ
# When fail to start docker:
firewall-cmd --get-active-zones
firewall-cmd --zone=docker --change-interface=docker0
firewall-cmd --runtime-to-permanent
systemctl restart docker

#

Install docker-compose

# Dcoker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose


# (optional) Verify
docker-compose --version

Advenced

# Move fat docker to other folder with symlink - Linux (bash)
sudo systemctl stop docker
sudo mv /var/lib/docker /data/.
sudo ln -s /data/docker /var/lib/docker
sudo systemctl start docker

# Move fat docker to other folder with symlink - Windows (Powershell)
move C:\ProgramData\docker\* D:\ProgramData\docker
cmd /c mklink /d C:\ProgramData\docker D:\ProgramData\docker


# Add default Log rotation
sudo bash -c 'cat >> /etc/docker/daemon.json' << EOF
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "512"
  }
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

# Execute docker without sudo
sudo groupadd docker
sudo usermod -aG docker $USER
#> Re-login to apply

# Show other docker version
yum list docker-ce --showduplicates | sort -r

# Restart 
## daemon
sudo systemctl daemon-reload
## docker service
sudo systemctl restart docker.service
## docker
sudo systemctl restart docker

# Remove stuff
docker container prune    # Remove all stopped containers
docker volume prune     # Remove all unused volumes
docker image prune     # Remove unused images
docker system prune     # All of the above, in this order: containers, volumes, images
docker ps -a -q | % { docker rm $_ }     # Remove container with PowerShell
docker rm $(docker ps -a -q)     # Remove container with Bash
docker volume rm $(docker volume ls -f dangling=true -q)

Ubuntu

# (optional) Remove old
sudo apt-get remove -y docker-ce docker-ce-cli docker docker-engine docker.io containerd runc

# Setting up
sudo apt-get update
sudo apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

## (optional) Verify fingerprint 
sudo apt-key fingerprint 0EBFCD88

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

# Install latest
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io

## (optional) Install other version.  PS."18.09 no need to install docker-ce-cli"
apt-cache madison docker-ce
sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

# (optional) Verify
sudo docker run hello-world

79 Comments

68 Trackbacks / Pingbacks

  1. current availability of hydroxychloroquine
  2. hydroxychloroquine test results
  3. new hydroxychloroquine studies
  4. coupon codes for ivermectil
  5. us cost of priligy
  6. stromectol safe for breastfeeding
  7. stromectol trihydrate capsules
  8. deltasone meaning
  9. stromectol and ibuprofen 800
  10. ivermect safe in pregnancy
  11. stromectol trihydrate and antiparasitic potassium tablets
  12. praziquantel price
  13. dosage for ivermectin in humans
  14. best over the counter viagra pill
  15. stromectol pill price
  16. ivermectin 3mg tablets price
  17. where can you get cialis
  18. buying viagra
  19. purchase stromectol
  20. can i buy generic cialis
  21. cialis tubs
  22. where can i buy generic cialis
  23. ivermectin resistance
  24. covid19 pill
  25. viagra or cialis
  26. canada drug cialis
  27. ivermectin nahdi
  28. what does viagra do
  29. cialis without a doctor prescription
  30. online casino real money free bonus
  31. cheap cialis india
  32. stromectol 3mg
  33. ivermectin 2ml
  34. gambling casino online
  35. cialis professional
  36. sildenafil generic over the counter
  37. buy generic cialis online
  38. ivermectin india
  39. eurocasino
  40. eurocasino
  41. buy stromectol 3 mg
  42. generic ivermectin for humans
  43. brazil ivermectin
  44. madridbet
  45. luckylandslots
  46. ivermectin price usa
  47. stromectol 5 mg
  48. ivermectin use in humans
  49. madritbet
  50. meritroyalbet
  51. meritroyalbet
  52. meritking
  53. eurocasino
  54. elexusbet
  55. eurocasino
  56. ivermectin for worms in humans
  57. generic for ivermectin
  58. meritroyalbet giriş
  59. ivermectin price usa
  60. buy ivermectin on line
  61. cialis india
  62. ivermectin 6 mg tablets
  63. molnupiravir and ivermectin
  64. bahis siteleri
  65. ivermectin cream 1%
  66. ivermectin 500ml
  67. 3interested
  68. flccc ivermectin

Leave a Reply

Your email address will not be published.


*