docker / docker/docker-py

Get ip of a conainer (feature request)

Open
#2,039 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

Hello,
It will be nice if we could have the IP address of a container, in order to run tcp request on it for test purposes.
Today my workaround is this, but I don't know if there is a better way to do this

 def getIpAddress(self):
        assert self.container.status=="running"
        cl =docker.api.client.APIClient(docker.utils.kwargs_from_env())
        return cl.inspect_container(self.__container.name)["NetworkSettings"]["IPAddress"]

Have a nice day ;)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing container-facing API and the Python workaround using APIClient.inspect_container and NetworkSettings["IPAddress"]. Determine where a supported container IP accessor belongs and define its behavior for running containers. Done means callers can obtain a container IP through the library for TCP test requests without relying on the workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.