Docker: Hello World

docker run hello-world

The installation message details what Docker is doing:

  1. Docker client contacted Docker daemon
  2. Docker daemon pulled the “hello-world” image from the Docker Hub (after checking locally)
  3. The Docker daemon created a new container from that image which runs the executable that produces the installation message output  (i.e. 1 to 4)
  4. Docker daemon streamed the output to the Docker client which sends it to the terminal

 

 

Python > parsing JSON

Given:

Note: [] are for lists, {} are for dictionaries.

We can parse it with Python like this:

 

https://stackoverflow.com/questions/2835559/parsing-values-from-a-json-file

 

Python: getting rid of the ‘u’ symbol when outputting text

I find it really annoying that whenever Python prints a string it prints out a u when it’s Unicode.

When you copy and paste that stuff it retains it all. If you’re copying and pasting JSON you’re left with broken JSON. Here’s how to get rid of it:

 

Python > Inspect an object

Use

print dir(<my object>)

where <my object> is your object name.

https://stackoverflow.com/questions/192109/is-there-a-built-in-function-to-print-all-the-current-properties-and-values-of-a?noredirect=1&lq=1

 

dirreturns the list of names in the current local scope.

https://docs.python.org/3/library/functions.html#dir

 

vars returns the __dict__attribute for a module, class or instance.

https://docs.python.org/3/library/functions.html#vars

 

__dict__ is a dictionary or other mapping object used to store an object’s writable attributes.

https://docs.python.org/3/library/stdtypes.html#object.__dict__