Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to get container IP address #140

Merged
merged 1 commit into from
Apr 12, 2022
Merged

Add method to get container IP address #140

merged 1 commit into from
Apr 12, 2022

Conversation

robdimsdale
Copy link
Member

@robdimsdale robdimsdale commented Apr 11, 2022

Summary

Add a helper method to a running Container object to obtain the IP address of the container on a given network.

Use Cases

This makes it easy to get the IP address of a running container for a given network name. Without this, you essentially have to run docker inspect and manually traverse the returned json.

Given that the default network is so often called bridge, I could see an argument for adding a second helper method to obtain the IP address on this specific network - something like this:

func (c Container) IPAddressForBridgeNetwork() string)

Signed-off-by: Sophie Wigmore [email protected]

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

@ryanmoran ryanmoran merged commit 54ab038 into main Apr 12, 2022
@ryanmoran ryanmoran deleted the ipaddress branch April 12, 2022 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants