20220715 Docker Setup on AWS
Docker setup on AWS
Choose a Ubuntu AMI rather that Amazon Linux 2 (AL2), because there wasn’t a specific repository for AL2.
Found instructions for installing Docker on AL2 on https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-container-image.html#create-container-image-prerequisites
Install using the repository
From https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
Add Docker’s official GPG key:
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
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 \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Install Docker engine
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl enable containerd.service
sudo systemctl enable docker.service
Post-installation steps for Linux
So you don’t have to do sudo everytime but adding the docker group grants privileges equivalent to the root user. From https://docs.docker.com/engine/install/linux-postinstall/
sudo groupadd docker
sudo usermod -aG docker $USER
Log out and log back in so that your group membership is re-evaluated.
On Linux, you can also run the following command to activate the changes to groups:
newgrp docker
Verify that you can run docker commands without sudo.
docker run hello-world
Useful Docker sites, containers, etc.
https://www.npmjs.com/package/nodemon https://github.com/nicolaka/netshoot https://docs.docker.com/get-started/