Skip to content

Instantly share code, notes, and snippets.

@mohanpedala
Last active September 5, 2019 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohanpedala/5c202f90681fee00ee39eaca2a06390e to your computer and use it in GitHub Desktop.
Save mohanpedala/5c202f90681fee00ee39eaca2a06390e to your computer and use it in GitHub Desktop.
Daily Docker
  • Set Timezone inside container
    • Create a Dockerfile
    vi Dockerfile
    
    FROM centos:latest
    ENV TZ=America/New_York
    
    # ENTRYPOINT ["ls", "-al"]
    CMD ["/bin/bash"]
    
    • Verify if it is working
    $ docker build -t centos/time .
    
    $ docker run -it centos/time bash
    
    [root@e882c8263928 /]# date
    Tue Nov 27 13:42:02 EST 2018
    
  • The docker system df command displays information regarding the amount of disk space used by the docker daemon.
    $ docker system df
    
    TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
    Images              5                   2                   16.43 MB            11.63 MB (70%)
    Containers          2                   0                   212 B               212 B (100%)
    Local Volumes       2                   1                   36 B                0 B (0%)
    Build Cache         0                   0                   0B                  0B
    
    $ docker system df -v
    
    Images space usage:
    
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE                SHARED SIZE         UNIQUE SIZE         CONTAINERS
    my-curl             latest              b2789dd875bf        6 minutes ago       11 MB               11 MB               5 B                 0
    my-jq               latest              ae67841be6d0        6 minutes ago       9.623 MB            8.991 MB            632.1 kB            0
    <none>              <none>              a0971c4015c1        6 minutes ago       11 MB               11 MB               0 B                 0
    alpine              latest              4e38e38c8ce0        9 weeks ago         4.799 MB            0 B                 4.799 MB            1
    alpine              3.3                 47cf20d8c26c        9 weeks ago         4.797 MB            4.797 MB            0 B                 1
    
    Containers space usage:
    
    CONTAINER ID        IMAGE               COMMAND             LOCAL VOLUMES       SIZE                CREATED             STATUS                      NAMES
    4a7f7eebae0f        alpine:latest       "sh"                1                   0 B                 16 minutes ago      Exited (0) 5 minutes ago    hopeful_yalow
    f98f9c2aa1ea        alpine:3.3          "sh"                1                   212 B               16 minutes ago      Exited (0) 48 seconds ago   anon-vol
    
    Local Volumes space usage:
    
    NAME                                                               LINKS               SIZE
    07c7bdf3e34ab76d921894c2b834f073721fccfbbcba792aa7648e3a7a664c2e   2                   36 B
    my-named-vol                                                       0                   0 B
    
    Build cache usage: 0B
    
    
    CACHE ID            CACHE TYPE          SIZE                CREATED             LAST USED           USAGE               SHARED
    0d8ab63ff30d        regular             4.34MB              7 days ago                              0                   true
    189876ac9226        regular             11.5MB              7 days ago                              0   
    
    • SHARED SIZE is the amount of space that an image shares with another one (i.e. their common data)
    • UNIQUE SIZE is the amount of space that is only used by a given image
    • SIZE is the virtual size of the image, it is the sum of SHARED SIZE and UNIQUE SIZE
  • --restart
    docker run -d --restart=unless-start -p 80:80 -p 443:443 -v <source>:<destination> <image>:<tag>
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment