Docker basic CheatSheet

https://docs.docker.com/get-started/

  • Install Docker:
  • Test Docker: docker run hello-world
  • Help:
    • docker –version
    • docker –help
    • docker COMMAND –help
  • Commands:
    • Show available images: docker images
    • Show containers: docker ps (docker container ls)
    • Manage containers:
      • List: docker container ls
      • Stop: docker container stop dsa34ewqe
      • Force stop: docker container kill dsa34ewqe
      • Remove: docker container rm dsa34ewqe
      • Execute bash: docker exec -it dsa34ewqe bash
      • Remove
    • Manage images:
      • List image: docker image ls
      • Remove image: docker rmi ubuntu/latest
      • Remove all images: docker rmi $(docker images -a -q)
      • Dangling images:
        • List: docker images -f dangling=true
        • Delete: docker images purge
      • Create image: docker build -t friendlyhello .
      • Run image:
        • docker run -d -p 4000:80 friendlyhello
        • docker run -d -p 4000:80 cadvga/get-started:part2
    • Manage compose:
      • docker-compose up -d