Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»General Articles»How to Get IP Address of A Docker Container

    How to Get IP Address of A Docker Container

    RahulBy RahulApril 2, 20201 Min ReadUpdated:April 10, 2020

    This tutorial will help you to get the IP address of a Docker container on your system. The docker binary provides network option to manage networking for the docker environment. Also, you can use inspect option to find the details of a Docker container. In this tutorial, we use inspect option to fetch docker container IP address via command line.

    Syntax

    Use below syntax to get IP address of a Docker container. You need to change CONTAINER ID/NAME with the actual container ID or name.

    docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <CONTAINER ID/NAME>
    

    Example

    For example, you have a docker container with the container id 1808352f0693. Just run the below command on terminal.

    docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 1808352f0693
    

    Output

    172.17.0.2
    
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Create Shortcut Commands using Alias in Linux
    Next Article How to Configure Nginx for WordPress Permalinks

    Related Posts

    How to Find Django Install Location in Linux

    Updated:April 27, 20221 Min Read

    (Resolved) – ReactJS 404 Error on Page Reload

    2 Mins Read

    Adding a New SSH Key in GitHub

    Updated:April 1, 20223 Mins Read

    13 Best Linux Terminal Emulators and Bash Editors

    8 Mins Read

    How To Install Oracle VirtualBox on Debian 11

    2 Mins Read

    10 Best Linux FTP Clients in 2022

    5 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    • (Resolved) Please install all available updates for your release before upgrading
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.