View on GitHub

learning-cloud-k8s

Notes and steps documented while learning k8s

Go to home

Go To Previous Step (AWS EC2 Setup)

Setup docker on Ubuntu

Machine environment

Local environment might matter for some shell commands

Setup steps

All commands mentioned in the guide are executed inside post doing SSH into AWS EC2 ubuntu instance

  1. Install/configure common/global repositories for getting software
    sudo apt install apt-transport-https ca-certificates curl software-properties-common
    
  2. Install docker public key
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
    
  3. 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
    
  4. Update the apt package index
    sudo apt-get update
    
  5. 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
    
  6. Start the docker engine as a service
    sudo service docker start
    
  7. 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
  8. 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.
      

Go To Next Step (Minikube Setup)