<\/span><\/h2>\nTo start with the Docker installation, we first need to log in to our server via SSH:<\/p>\n
ssh [username]@[server_ip_address] -p [SSH port]<\/pre>\nModify the [username]<\/code><\/strong> ,[server_ip_address]<\/strong><\/code>, and [SSH port]<\/strong><\/code>parameters based on your server details. It is recommended to use the ‘root’ account for Docker installation.<\/p>\nBefore starting with the installation, we recommend updating all installed packages to their latest versions which helps to maximize compatibility when installing new software. You can do that by running this next command:<\/p>\n
apt-get update\r\napt-get upgrade<\/pre>\n<\/span>Step 2: Install Required Packages<\/span><\/h2>\nIt is recommended to install the Linux common libraries along with these dependencies to help avoid missing any required packages during the installation process.<\/p>\n
apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common build-essential<\/pre>\n<\/span>Step 3: Setting Up Docker Repository<\/span><\/h2>\nCurrently, there are three ways to install Docker on our system: through Docker’s official repository, from a Debian (.deb) package, and from a script created by Docker developers. Also, Docker has three update channels – stable, test, and nightly.<\/p>\n
\n- Stable<\/strong> – provides the latest stable release of Docker.<\/li>\n
- Test – <\/strong>provides pre-releases for testing purposes.<\/li>\n
- Nightly<\/strong> – provides the latest possible build. This is usually unstable.<\/li>\n<\/ul>\n
For this tutorial, we will install Docker Community Edition (CE) using their official repository. This is the recommended method of installation for both development and production environments due to the fact that we can select an update channel, where the package itself can then be easily updated.<\/p>\n
To add the Docker repository to our server, we need to add the GPG keys first with the following commands:<\/p>\n
curl -fsSL https:\/\/download.docker.com\/linux\/debian\/gpg | sudo apt-key add -<\/pre>\nOnce added, add the repository pointing to ‘stable’ update channel.<\/p>\n
add-apt-repository \"deb [arch=amd64] https:\/\/download.docker.com\/linux\/debian $(lsb_release -cs) stable\"<\/pre>\nWe can now update our packages, which should include the repository from Docker.<\/p>\n
apt-get update<\/pre>\nAfter applying command, you should see the repository link added:<\/p>\n
Get:5 https:\/\/download.docker.com\/linux\/debian stretch InRelease [44.8 kB]\r\nGet:7 https:\/\/download.docker.com\/linux\/debian stretch\/stable amd64 Packages [8,437 B]<\/pre>\n