Last active
August 20, 2024 06:36
-
-
Save steveebenezer/7816dfb848e521abb3ee786dabd9c065 to your computer and use it in GitHub Desktop.
Installing Docker & Docker Compose on EC2 Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Update the Package List | |
| sudo apt-get update | |
| # Install Prerequisite Packages | |
| sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common | |
| # Add Docker’s Official GPG Key | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
| # Add the Docker Repository | |
| sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
| # Update the Package List Again | |
| sudo apt-get update | |
| # Install Docker | |
| sudo apt-get install -y docker-ce | |
| # Start and Enable Docker | |
| sudo systemctl start docker | |
| sudo systemctl enable docker | |
| # Add User to the Docker Group | |
| sudo usermod -aG docker $USER | |
| # Install Docker Compose | |
| sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
| # Apply executable permissions to the binary | |
| sudo chmod +x /usr/local/bin/docker-compose | |
| # Verify the installation | |
| docker-compose --version | |
| # To undo everything I just did: | |
| sudo apt-get purge -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
| sudo rm -rf /var/lib/docker | |
| sudo rm -rf /var/lib/containerd | |
| sudo rm /usr/local/bin/docker-compose | |
| sudo rm /etc/apt/keyrings/docker.gpg | |
| sudo add-apt-repository --remove "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
| sudo apt-get update |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment