Created
April 21, 2023 20:06
-
-
Save danbailo/42aa9a22882e93fa8c8f647e1b677889 to your computer and use it in GitHub Desktop.
Init EC2 instance with docker/docker compose
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
# 1. Update the apt package index and install packages to allow apt to use a repository over HTTPS: | |
sudo apt-get update | |
sudo apt-get install \ | |
ca-certificates \ | |
curl \ | |
gnupg | |
# 2. Add Docker’s official GPG key: | |
sudo install -m 0755 -d /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
sudo chmod a+r /etc/apt/keyrings/docker.gpg | |
# 3. Use the following command to set up the repository: | |
echo \ | |
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ | |
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ | |
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
# 4. Update system | |
sudo apt-get update | |
# 5. Install Docker Engine, containerd, and Docker Compose. | |
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
# Permissions | |
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
# reboot | |
newgrp docker | |
# reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment