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

Allow dockerize to wait for network dependencies before main command #23

Merged
merged 1 commit into from Jan 25, 2016

Conversation

Projects
None yet
4 participants
@mefellows
Contributor

mefellows commented Jan 25, 2016

It is common when using tools like Docker Compose to depend on services in other linked containers, however oftentimes relying on links is not enough - whilst the container itself may have started, the service(s) within it may not yet be ready - resulting in shell script hacks to work around race conditions.

This PR gives dockerize the ability to wait for services on a specified protocol (tcp, tcp4, tcp6, http, and https) before starting the main application:

dockerize -wait tcp://db:5432 -wait http://web:80 -timeout 10s somecommand

Note the timeout is optional and defaults to 10s.

I've found this to be particularly useful when using Docker Compose as a test harness, where one of the containers needs to test another. Instead of netcating my way around the problem, I can just wrap the command using dockerize.

I also fixed a few minor grammatical/spelling mistakes.

Related links:

Show outdated Hide outdated dockerize.go Outdated
@thaJeztah

This comment has been minimized.

Show comment
Hide comment
@thaJeztah

thaJeztah Jan 25, 2016

ping @jwilder looks like this PR has been updated; ptal 👍

thaJeztah commented Jan 25, 2016

ping @jwilder looks like this PR has been updated; ptal 👍

jwilder added a commit that referenced this pull request Jan 25, 2016

Merge pull request #23 from mefellows/wait-for-dependencies
Allow dockerize to wait for network dependencies before main command

@jwilder jwilder merged commit a2e1043 into jwilder:master Jan 25, 2016

@mefellows mefellows deleted the mefellows:wait-for-dependencies branch Jan 25, 2016

@mefellows

This comment has been minimized.

Show comment
Hide comment
@mefellows

mefellows Jan 25, 2016

Contributor

Thanks! 🎉

Contributor

mefellows commented Jan 25, 2016

Thanks! 🎉

@jwilder

This comment has been minimized.

Show comment
Hide comment
@jwilder

jwilder Jan 25, 2016

Owner

Thanks @mefellows! Nice feature idea.

Owner

jwilder commented Jan 25, 2016

Thanks @mefellows! Nice feature idea.

@mefellows

This comment has been minimized.

Show comment
Hide comment
@mefellows

mefellows Jan 25, 2016

Contributor

No worries at all - do I need to do anything to get this 'released' or will you look after that in due course?

Contributor

mefellows commented Jan 25, 2016

No worries at all - do I need to do anything to get this 'released' or will you look after that in due course?

@jwilder

This comment has been minimized.

Show comment
Hide comment
@jwilder

jwilder Jan 25, 2016

Owner

@mefellows I just created a new v0.1.0 release.

Owner

jwilder commented Jan 25, 2016

@mefellows I just created a new v0.1.0 release.

@mefellows

This comment has been minimized.

Show comment
Hide comment
@mefellows

mefellows Jan 25, 2016

Contributor

Awesome, thanks!

Contributor

mefellows commented Jan 25, 2016

Awesome, thanks!

@markriggins

This comment has been minimized.

Show comment
Hide comment
@markriggins

markriggins Mar 30, 2016

nice work! I'm using this now, so thankyou

markriggins commented on 0ab5bf8 Mar 30, 2016

nice work! I'm using this now, so thankyou

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment