P E N C I L
Login
Docker basics
  1. docker commit containerid imagename
  2. docker build --tag username/repo:latest  . 
    1. This command use the Dockerfile in the current folder
    2. Tag is optional (no tag by default)
      latest is optional
    3. When build, each command add a layer and a image.
      If fail, you still have image of last success command
      docker run -it imageid bash

  3. docker images
    Repostiory  TAG Image ID
  4. docker ps 
  5. show running container
  6. docker ps -a
    show all container 

  7. docker start -ai containerid
    Start a stopped container (the command in CMD is run)
  8. docker attach containerId
    Connect to a running docker. The same console (ie. if exit new console, then all other exits)
  9. docker exec -it dd bash
    Run command in a "running" container
  10. docker run -it --rm busybox /bin/bash 
    Run a command in a new container 
    1. -it: run in interactive tty
    2. --rm: delete container after exit
    3. /bin/bash override the "CMD"
      The real execited command: entrypoint + cmd 
    4. Override command
      1. CMD docker run image bash -c "echo 1; echo 2"
      2. PORT:  docker run --expose 8000 -p 80:8000 image
  11. docker inspect containerId
  12. Process
    1. docker build 
      Build email with cmd in docker file
    2. docker run image command
      1. Start container and override the command
        Store container
    3. docker start -ai containerid.
      Start stop container with command in container (you can see command with docker ps)
    4. docker attach container id
      Attach runner container id (the same in/out put)
    5. docker exec -it containerid mycommand
      Run another command in a running container
    6. docker commit container