Docker Installation Guide
This guide covers the installation of Docker and Docker Compose on CentOS and Amazon Linux. Follow the respective instructions based on your environment.
Docker Installation for CentOS
Prerequisites
- CentOS 8 or higher
- Root or sudo access
- Minimum 2GB of RAM recommended, 8GB of RAM recommended for all Liberty Framework Services.
Step 1: Update System Packages
Before starting the installation, update your system to ensure all packages are up-to-date.
if Podman is installed, remove all packages, artifacts and containers storage
Step 2: Install Required Dependencies
Install the necessary packages required to set up the Docker repository.
Step 3: Set Up the Docker Repository
Add the Docker repository to your CentOS system.
Step 4: Install Docker
Install Docker Engine, CLI, and Containerd.
Step 5: Start and Enable Docker
Start the Docker service and enable it to start on boot.
Step 6: Verify Docker Installation
Verify the installation by running a test Docker container.
If the container runs and displays a welcome message, Docker is installed correctly.
Step 7: Adding Your User to the Docker Group (Optional)
To run Docker commands without sudo
, add your user to the Docker group.
Log out and log back in to apply the group changes.
Uninstall Docker
To remove Docker, the CLI, Containerd, and Docker Compose, use the following commands:
Docker Installation for Amazon Linux OS
Prerequisites
- Amazon Linux or Amazon Linux 2
- Root or sudo access
- Minimum 2GB of RAM recommended, 8GB of RAM recommended for all Liberty Framework Services.
Step 1: Update System Packages
Before starting the installation, update your system to ensure all packages are up-to-date.
Step 2: Install Docker
Install Docker using the Amazon Linux Extras & yum package manager.
Step 3: Start and Enable Docker
Start the Docker service and enable it to start on boot.
Step 4: Verify Docker Installation
Verify the installation by running a test Docker container.
If the container runs and displays a welcome message, Docker is installed correctly.
Step 5: Install Docker Compose
Download the current stable release of Docker Compose:
Apply executable permissions to the binary:
Verify that the installation was successful:
Step 6: Adding Your User to the Docker Group (Optional)
To run Docker commands without sudo
, add your user to the Docker group.
Log out and log back in to apply the group changes.
Uninstall Docker
To remove Docker, the CLI, Containerd, and Docker Compose, use the following commands:
Post installation Tasks
If you want to set a custom directory for docker and if you are running behind a proxy, the docker service must be modified
Edit the service: /lib/systemd/system/docker.service
If you want to change the default IP range (172.17.x.x) for docker Edit the file: /etc/docker/daemon.json
Conclusion
You have successfully installed Docker and Docker Compose on your CentOS or Amazon Linux OS system. You can now begin deploying and managing your Docker containers for Liberty Framework.