🚩
Cyber Explained
  • WHOAMI
  • Technologies
    • Docker
      • Setup Docker
      • Terminology
      • Docker Hub
      • Docker Images
      • Docker Containers
      • Working with Containers
      • Virtualization vs Containerization
      • Nutshell
      • Troubleshoot
    • Android Application
      • Application File Structure
      • Layout and Resources for UI
      • Activities
      • Intents
      • Activity lifecycle and state
      • Implicit intents
    • Active Directory
      • Attacking Active Directory: 0 to 0.9
      • Resources
    • Kerberos
  • RED TEAMING
    • Attacking Kerberos
      • User Enum and Brute Force
      • AS-REP Roasting
      • Kerberoasting
    • MITRE ATT&CK
    • Resources
  • PenTesting
    • Android Pentesting
      • Re-Build App
      • Using Frida on Android without root
    • Web Pentesting
      • XSS
      • SQLi
      • Authentication Vulnerabilities
      • Session Security
      • CSRF
      • Path Traversal
      • File Inclusion
      • Business Logic Vulnerabilities
      • HTTP Host header attacks
      • SSRF
      • HTTP Request Smuggling
      • OS command injection
      • Access control vulnerabilities
    • OWASP Testing Guide
      • 1.0 Information Gathering
      • 2.0 Configuration and Deployment Management Testing
      • 3.0 Identity Management Testing
      • 4.0 Authentication Testing
      • 5.0 Authorization Testing
      • 6.0 Session Management Testing
      • 7.0 Input Validation Testing
      • 8.0 Testing for Error Handling
      • 9.0 Testing for Weak Cryptography
      • 10.0 Business Logic Testing
      • 11.0 Client-side Testing
      • 12.0 API Testing
  • Programming
    • Python
      • Hello World !
        • Variables and Data Types
        • Lists, Tuple, Sets and Dictionaries
        • If Statement
        • While Loops
        • For Loops
        • Functions
        • Classes and Objects
        • Creating Modules
        • Creating Packages
        • Exception Handling
      • System Pogramming
        • File Handling
        • OS Interaction with OS Library
        • Multithreading
        • Signals
        • Subprocess
        • Code Examples
      • Network Programming
        • Socket Programming
        • Packet Injection with Raw Sockets
        • SocketServer Framework
        • Packet Sniffing with Scapy
        • Creating a Web Server
        • Packet Injection with Scapy
        • Packet Sniffing with Raw Sockets
        • Programming with Scapy
  • Operating Systems
    • Windows*
    • Linux
      • System Structure
      • VI Text Editor
      • Working with the Linux Shell
      • Managing Users and Groups
      • Managing Files and Directories
  • Networks
    • Page 1
Powered by GitBook
On this page
  • Displaying Docker Images
  • Removing Docker Images
  • Docker inspect
  1. Technologies
  2. Docker

Docker Images

PreviousDocker HubNextDocker Containers

Last updated 3 years ago

In Docker, everything is based on Images. An image is a combination of a file system and parameters. Let’s take an example of the following command in Docker.

➜  ~ docker run hello-world 
  • The Docker command is specific and tells the Docker program on the Operating System that something needs to be done.

  • The run command is used to mention that we want to create an instance of an image, which is then called a container.

  • Finally, "hello-world" represents the image from which the container is made.

Now let’s look at how we can use the Ubuntu image available in Docker Hub to run Ubuntu on our Ubuntu machine. We can do this by executing the following command on our Ubuntu machine βˆ’

➜  ~ sudo docker run -it ubuntu /bin/bash

Note the following points about the above sudo command βˆ’

  • We are using the sudo command to ensure that it runs with root access.

  • Here, Ubuntu is the name of the image we want to download from Docker Hub and install on our Ubuntu machine.

  • ─it is used to mention that we want to run in interactive mode.

  • /bin/bash is used to run the bash shell once Ubuntu is up and running.

Displaying Docker Images

To see the list of Docker images on the system, you can issue the following command.

➜  ~ sudo docker images 
REPOSITORY                                     TAG       IMAGE ID       CREATED        SIZE
opensecurity/mobile-security-framework-mobsf   latest    7a567d84d242   29 hours ago   2.2GB
ubuntu                                         latest    2b4cba85892a   40 hours ago   72.8MB
  • TAG βˆ’ This is used to logically tag images.

  • Image ID βˆ’ This is used to uniquely identify the image.

  • Created βˆ’ The number of days since the image was created.

  • Virtual Size βˆ’ The size of the image.

Removing Docker Images

The Docker images on the system can be removed via the docker rmi command.

➜  ~ sudo docker rmi 2b4cba85892a
...

Docker inspect

This command is used see the details of an image or container.

➜  ~ sudo docker inspect ubuntu 
[
    {
        "Id": "sha256:",
        "RepoTags": [
            "ubuntu:latest"
        ],
        "RepoDigests": [
            "ubuntu@sha256:"
        ],
        "Parent": "",
        "Comment": "",
        "Created": "2022-03-03T20:19:33.779048748Z",
        "Container": "",
        "ContainerConfig": {
            "Hostname": "b32714f341a6",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "#(nop) ",
                "CMD [\"bash\"]"
            ],
            "Image": "sha256:",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {}
        },
        "DockerVersion": "20.10.12",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "bash"
            ],
            "Image": "sha256:",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 72759661,
        "VirtualSize": 72759661,
        "GraphDriver": {
            "Data": {
                "MergedDir": "/var/lib/docker/overlay2/01fad90e654398c4edb07ceeb8f64a34b2428e0fd4cedd9b41f25782f0ea8675/merged",
                "UpperDir": "/var/lib/docker/overlay2/01fad90e654398c4edb07ceeb8f64a34b2428e0fd4cedd9b41f25782f0ea8675/diff",
                "WorkDir": "/var/lib/docker/overlay2/01fad90e654398c4edb07ceeb8f64a34b2428e0fd4cedd9b41f25782f0ea8675/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]