Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save AnythingLinux/f97b5cf81587be0bd803393e87fed493 to your computer and use it in GitHub Desktop.

Select an option

Save AnythingLinux/f97b5cf81587be0bd803393e87fed493 to your computer and use it in GitHub Desktop.
Docker and Docker Compose Install Ubuntu 26.04 LTS Linux
#!/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
# Docker Installation
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
> /etc/apt/sources.list.d/docker.list
apt update
apt -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl enable --now docker
systemctl start docker
systemctl enable docker
usermod -aG docker ${USER}
systemctl restart docker
systemctl status docker
# 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
apt update -y
apt upgrade -y
docker-compose --version
docker --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