Skip to main content

JSON on Docker

What is JSON?

JSON is short for JavaScript Object Notation. It implements a lightweight data interchange format based on a subset of JavaScript language. JSON provides a way to store information such that it is easy for machines to parse and generate. Docker uses JSON as its default Logging Driver to communicate information.

JSON is a way to store information in an organized, easy-to-access manner. It is used primarily to transmit data, as an alternative to XML.

As an example of how Docker leverages JSON, here's an excerpt of the docker inspect <Name | ID> output:

$ docker inspect 978d
        "Id": "sha256:978d85d02b87aea199e4ae8664f6abf32fdea331884818e46b8a01106b114cee",
        "RepoTags": [
        "Container": "4799c1aee3356a0d8e51a1e6e48edc1c4ca224e55750e26916f917bdecd96079",
        "ContainerConfig": {
            "Hostname": "ed11f485244a",
            "Cmd": [
                "#(nop) ",
                "CMD [\"/bin/bash\"]"

As the above example shows, JSON is built on two structures:
  • Name/Value pairs, delimited by comma
    • e.g. "Hostname": "ed11f485244a"
  • Ordered list of values
    • realized as an array, vector, list, or sequence
    • e.g. ["/bin/sh","-c","#(nop) ","CMD [\"/bin/bash\"]"]

In JSON, there are several data structures, including:
  • Array
    • An associative array of values
    • begins with [ (left bracket) and ends with ] (right bracket)
    • Values are separated by , (comma)
  • Object
    • Begins with { (left curly brace) and ends with } (right curly brace)
    • An unordered set of name/value pairs
    • Name and value separated by : (colon)
    • Name/Value pairs delimited by , (comma)
    • Object
      • {string : value,…}
  • Value
    • string
    • number
    • object
    • array
    • true
    • false
    • null

JSON’s design goal is simplicity and universality. It aims to be trivial to generate and parse.


Creative Commons License Licensed under a Creative Commons Attribution 4.0 International License.


Popular posts from this blog

3.2.13 DNS poisoning and ARP poisoning

DNS poisoning and ARP poisoning DNS and ARP poisoning are types of man-in-the-middle (MITM) attacks, which are types of spoofing attacks. A spoofing attack is an attempt by someone to masquerade as someone else. Address Resolution Protocol (ARP) cache poisoning (sometimes also known as ARP Poison Routing) allows an attacker on the same network segment (subnet) as its victims to eavesdrop on all network traffic between the victims. ARP poisoning, tries to convince the network that the attacker's MAC address is the one associated with an IP address so that traffic sent to that IP address is wrongly sent to the attacker's machine. In ARP poisoning, the MAC (Media Access Control) address table of the victim host is ‘poisoned’ with false data. Incorrect data for a victim host is interjected into the MAC table of the victim host to force the victim to communicate with the wrong host. By faking this value, it is possible to make it look as if the data came from a network that

Docker Command Flowchart

Docker Command Flowchart Inspired by a post at this flowchart illustrates some of the Docker objects and the commands that apply to them. For example, to preserve changes made in a container object and convert it into an image , use the docker commit command. References: Licensed under a Creative Commons Attribution 4.0 International License .

Docker Compose

Docker Compose Particularly with multi-tiered applications, your Dockerfile and runtime commands get increasingly complex. Docker Compose is a tool to streamline the definition and instantiation of multi-tier, multi-container Docker applications. Compose requires a single configuration file and a single command to organize and spin up the application tier. Docker Compose simplifies the containerization of a multi-tier, multi-container application, which can be stitched together using the docker-compose.yml configuration file and the docker-compose command to provide a single application service. The Compose file provides a way to document and configure all of the application’s service dependencies (databases, queues, caches, web service APIs, etc.) Docker Compose defines and runs complex services: define single containers via Dockerfile describe a multi-container application via single configuration f