Go To Previous Step (AWS EC2 Setup)
Setup docker on Ubuntu
Machine environment
Local environment might matter for some shell commands
- AWS EC2 instance
- OS Ubuntu 20.x
Setup steps
All commands mentioned in the guide are executed inside post doing SSH into AWS EC2 ubuntu instance
- Install/configure common/global repositories for getting software
sudo apt install apt-transport-https ca-certificates curl software-properties-common
- Install docker public key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
- Set up the stable repository (not nightly or test)
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- Update the apt package index
sudo apt-get update
- Install the latest version of Docker Engine and containerd (not sure whether ce-cli and containerd were required.
sudo apt-get install docker-ce docker-ce-cli containerd.io
- Start the docker engine as a service
sudo service docker start
- Give access on docker shell to local user
sudo usermod -aG docker $USER
- re-login to the terminal post running the command. If this is not done, docker commands are available through sudo only
- Run a sample hello-world app
docker run hello-world
- Output, in case of success
Hello from Docker! This message shows that your installation appears to be working correctly.
- Output, in case of success