Last active
December 21, 2022 00:45
-
-
Save davetang/7bc90ba0cb35acb32fa2271fb2d5f25e to your computer and use it in GitHub Desktop.
Setup Docker on an EC2 instance running Ubuntu; see https://davetang.org/muse/2022/12/07/running-rstudio-server-on-amazon-ec2/.
This file contains 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
#!/usr/bin/env bash | |
set -euo pipefail | |
sudo apt-get update | |
sudo apt-get install -y \ | |
ca-certificates \ | |
curl \ | |
gnupg \ | |
lsb-release \ | |
unzip | |
sudo mkdir -p /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
echo \ | |
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt-get update | |
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin | |
sudo usermod -aG docker ubuntu | |
GITHUB_DIR=/home/ubuntu/github | |
mkdir ${GITHUB_DIR} && cd ${GITHUB_DIR} | |
git clone https://github.com/davetang/learning_docker.git | |
sudo chown -R ubuntu:ubuntu ${GITHUB_DIR} | |
>&2 echo Setup complete. Please logout and login again. | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment