Skip to content

Instantly share code, notes, and snippets.

@ScottJWalter
Last active January 17, 2025 15:38
Show Gist options
  • Select an option

  • Save ScottJWalter/7a8dc06c812a952d3a5f9884b76be9fd to your computer and use it in GitHub Desktop.

Select an option

Save ScottJWalter/7a8dc06c812a952d3a5f9884b76be9fd to your computer and use it in GitHub Desktop.
Install docker into Ubuntu instance (based on docs.docker.com)
#!/bin/bash
# update apt repos
sudo apt-get update
# install curl and keyring (certificate) support
sudo apt-get install -y \
ca-certificates \
curl \
python3-pip \
python-is-python3
sudo install -m 0755 -d /etc/apt/keyrings
# Add Docker's official GPG key:
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:
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" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
# install docker (et al)
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# verify
sudo docker run hello-world
@ScottJWalter
Copy link
Copy Markdown
Author

ScottJWalter commented Dec 15, 2024

Just a simple shell script that installs docker and its dependencies on Ubuntu. Taken from the docker documentation. I threw this together to remember how to spin up Multipass VMs.

curl

bash <(curl -sL https://bit.ly/bootstrap-docker-ubuntu)

wget

bash <(wget -nv -O - https://bit.ly/bootstrap-docker-ubuntu) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment