Last active
June 6, 2026 20:42
-
-
Save AnythingLinux/f97b5cf81587be0bd803393e87fed493 to your computer and use it in GitHub Desktop.
Docker and Docker Compose Install Ubuntu 26.04 LTS Linux
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
| #!/bin/sh | |
| apt update -y | |
| apt-get upgrade -y | |
| dpkg-reconfigure tzdata | |
| apt install build-essential checkinstall | |
| apt install ubuntu-restricted-extras | |
| apt install software-properties-common | |
| apt upgrade -o APT::Get::Show-Upgraded=true | |
| apt-show-versions | grep upgradeable | |
| apt install apt-show-versions | |
| apt update -y | |
| apt-get upgrade -y | |
| apt -f install | |
| apt autoremove | |
| apt -y autoclean | |
| apt -y clean | |
| apt update | |
| reboot | |
| # Install Docker | |
| # Add Docker's official GPG key: | |
| sudo apt update | |
| sudo apt install ca-certificates curl | |
| sudo install -m 0755 -d /etc/apt/keyrings | |
| sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc | |
| sudo chmod a+r /etc/apt/keyrings/docker.asc | |
| # Add the repository to Apt sources: | |
| sudo tee /etc/apt/sources.list.d/docker.sources <<EOF | |
| Types: deb | |
| URIs: https://download.docker.com/linux/ubuntu | |
| Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") | |
| Components: stable | |
| Architectures: $(dpkg --print-architecture) | |
| Signed-By: /etc/apt/keyrings/docker.asc | |
| EOF | |
| apt update | |
| apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
| apt update | |
| apt update -y | |
| systemctl start docker | |
| systemctl enable docker | |
| usermod -aG docker ${USER} | |
| systemctl restart docker | |
| systemctl status docker | |
| docker --version | |
| # Docker Compose Install | |
| curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
| chmod +x /usr/local/bin/docker-compose | |
| ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose | |
| newgrp docker | |
| apt update -y | |
| apt upgrade -y | |
| docker-compose --version | |
| # Verify that the installation is successful by running the hello-world image: | |
| docker run hello-world | |
| #Docker Image Restart, Stop and Delete | |
| $ Restart | |
| docker restart $(docker ps -aq) | |
| docker restart $(docker ps -a -q) | |
| List all containers (only IDs) | |
| $ docker ps -aq | |
| Stop all running containers. | |
| $ docker stop $(docker ps -aq) | |
| Remove all containers. | |
| $ docker rm $(docker ps -aq) | |
| Remove all images. | |
| $ docker rmi $(docker images -q) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment