Skip to content
GitHub Twitter

Install Docker on Amazon Linux 2023

Install Docker on Amazon Linux 2023

Docker has become an essential tool for modern software development and deployment. It allows you to package, distribute, and run applications and their dependencies inside isolated containers. Amazon Linux is a popular choice for hosting Docker containers on Amazon Web Services (AWS). In this guide, we will walk you through the steps to install Docker on Amazon Linux 2023, ensuring your ready to harness the power of containerization for your projects.

Prerequisites

Before we dive into the installation process, make sure you have the following:

  • An Amazon Linux 2023 Instance: You should have a running Amazon Linux 2023 instance where you want to install Docker.
  • SSH Access: Ensure you have SSH access to your Amazon Linux instance, either through the AWS Management Console or a terminal.

Step 1: Update the System

As the best practice, begin by updating your system's package repositories to get the latest updates and security patches:

sudo yum update -y

Step 2: Update and Upgrade Amazon Linux 2023 Packages

While Amazon Linux traditionally uses the yum package manager, you can leverage the compatibility of dnf as a drop-in replacement. The Following will ensure all the installed packages on our system are up-to-date along with security updates. Also, the DNF package manager will rebuild its package index cache.

sudo dnf update

Step 3: Installing Docker

By running following, we use the Amazon repository to download and install the Docker. Although, the version of the Docker available through the system repo will not be the latest one but the most stable.

sudo dnf install docker

you should see the following installation log:

docker-al2023-install-log.png

Step 4: Start and Enable Docker

Once Docker is installed, start the Docker service and enable it to start on system boot:

sudo systemctl start docker
sudo systemctl enable docker

To check and confirm the docker service is running, run the following:

sudo systemctl status docker

or to check the docker version:

sudo docker --version

Step 5: Add Your User to the Docker Group (Optional)

To run Docker commands without the need for sudo, you can add your user to the docker group:

sudo usermod -aG docker $USER
newgrp docker

Uninstallation

In order to remove the docker from your Amazon Linux 2023 instance, use the following command:

sudo dnf remove docker