Skip to content

Instantly share code, notes, and snippets.

@somahargitai
Last active July 21, 2020 15:21
Show Gist options
  • Save somahargitai/90953e52690da87252ba98863f3f0ed5 to your computer and use it in GitHub Desktop.
Save somahargitai/90953e52690da87252ba98863f3f0ed5 to your computer and use it in GitHub Desktop.
Cheatsheet for modern cloud environment - AWS & Docker

cheatsheet list

Docker & AWS tips and tricks

Contents:

  1. Installation
  2. My favourites
  3. Basics
  4. Advanced
  5. Detailed Basics
  6. Database management

0) Installation

Install Docker on Win 10 Home

UPDATE Docker now runs on Win10 Home. You will need version 2004, WSL2, then you can simply download Docker from its website and install https://docs.docker.com/docker-for-windows/wsl/?fbclid=IwAR3Wjq8mOVnnTwCV069wVFyuO42XUfAXRx509MMqVVV3Be9OPqO8dMxyQd0

As Docker requires Win 10 Pro, is not possible, so as a workaround, use VirtualBox and run Docker inside: Michael Wanyoike's tutorial

It installs:

  • Docker Machine (a tool that lets you install Docker Engine on virtual hosts, and manage the hosts with docker-machine commands)
  • VirtualBox (Virtual Machine engine)
  • command line Docker client elements, normally part of Docker installation. Now we should install them manually in Windows, so we can use them to command Docker in Virtual Box by Docker Machine (docker-cli, docker-compose)

1) My favourites

most-used, but not obvious things

  • Stop / remove all Docker containers
    docker stop $(docker ps -a -q)
    docker rm $(docker ps -a -q)

  • Delete all running and stopped containers
    docker container rm -f $(docker ps -aq)

2) Basics

You ought to install:

  • Docker - simply use install file from Docker website

  • AWS CLI

  • Everyday commands:

    • docker start 273a378b51a7 start docker container having container id 273a378b51a7
    • docker stop 273a378b51a7 stop docker container having container id 273a378b51a7
    • docker ps list active containers (Container ID, Image, Command, Created, Status, Ports, container name)
    • docker ps -a list active and passive containers

3) Advanced

4) Detailed Basics

  • docker run -d -p 8000:8000 --name dynamoDB dwmkerr/dynamodb
    • run docker container dwmkerr/dynamodb
    • -d in detached mode (in the background without terminal logs)
    • -p 8000:8000 map dynamodb service's port 8000 to the external port 8000 where you will be able to reach it
    • --name dynamoDB with name dynamoDB
    • for more details look at Docker run reference

5) AWS related

  • DynamoDB running in a Docker container
    • aws dynamodb list-tables --endpoint-url http://localhost:8000
      list dynamo tables from docker-dynamodb on PORT 8000 with AWS CLI command
    • aws dynamodb scan --table-name tablenamesomething --endpoint-url http://localhost:8000
      Print whole dynamodb table with AWS CLI on port 8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment