Saturday 18 August 2018

Google Spreadsheet API

https://medium.com/@ashokyogi5/a-beginners-guide-to-google-oauth-and-google-apis-450f36389184


Friday 17 August 2018

Docker Notes

1. What is a Dockerfile?

  • Docker can build images automatically by reading the instructions from a Dockerfile. A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image. 
2. What are the most common Docker command? 

Build commands:
  • docker build -t name:version:
    Build an image from the Dockerfile in the current directory and tag the image
  • docker images:
    List all images that are locally stored with the Docker engine
  • docker rmi imagename (REPOSITORY:TAG)
    remove an image from local
Ship commands:
  • docker pull
  • docker push
Run commands:

  • docker run 
--rm remove container automatically after it exits 
--it connect the container to terminal
--name name the container 
-p 5000:80 expose port 5000 externally and map to port 80 
-v create a host mapped volume inside the container the image from which the container is instantiated the command to run inside the container

  • docker stop
  • docker kill 
  • docker ps
    List all containers
  • docker exec --it container bash
    create a process inside a container and connect to the terminal

https://www.docker.com/sites/default/files/Docker_CheatSheet_08.09.2016_0.pdf


3. Image vs Container 

Image vs Container is like Class vs Object

4. Where to check out some example Dockerfile?

https://github.com/docker-library/python/blob/8601079d1f70b03c01408377716a3243ce75cec9/3.7/stretch/Dockerfile

https://github.com/Quantisan/docker-clojure/blob/e04878d311653b89714e15d8fa8d6081f2c2d773/debian/lein/Dockerfile

5. How to clean local docker file? images, contains and volumes? 

docker system prune - removing dangling images
docker rmi
docker rm
docker run --rm


https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes

6. What are most common dockerfile command?


  • FROM
    The FROM instruction initializes a new build stage and sets the Base Image for subsequent instructions. As such, a valid Dockerfile must start with a FROM instruction
  • RUN
    RUN <command>
    • RUN lein test && \
      • lein uberjar
    RUN ["executable", "param1", "param2"]
  • CMD
  • ENTRYPOINT
  • EXPOSE
    • EXPOSE 80/tcp
    • Regardless of the EXPOSE settings, you can override them at runtime by using the -p flag. 
  • ENV
    • ENV myName="John Doe"  \
    •     myCat=fluffy
  • ADD
    • The ADD instruction copies new files, directories or remote file URLs from <src> and adds them to the filesystem of the image at the path <dest>
    • ADD files* /somedir/
  • COPY
  • WORKDIR
  • ARG
  • LABEL
    • The LABEL instruction adds metadata to an image. A LABEL is a key-value pair. To include spaces within a LABEL value, use quotes and backslashes as you would in command-line parsing. 
7. The Process:

Find the Docker Base Image
Build my own Docker Image
Run the docker image