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

last_ip_used does not sort correctly #10

Open
csiess opened this issue Feb 26, 2018 · 0 comments
Open

last_ip_used does not sort correctly #10

csiess opened this issue Feb 26, 2018 · 0 comments

Comments

@csiess
Copy link

csiess commented Feb 26, 2018

Hi,

thanks a lot for this great script.
I had a small issue:

START_ALIAS_LINUX="10.2.237.1";
END_ALIAS_LINUX="10.2.237.49"

This stopped the script working beyond IP 10.2.237.10 because: last_ip_used outputs 10.2.237.9 where it should output 10.2.237.10:

docker inspect --format '{{ .HostConfig }}' $(docker ps -aq)| grep -o '[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+ 8000'|cut -d" " -f 1|sort -u|tail -1
10.2.237.9

docker inspect --format '{{ .HostConfig }}' $(docker ps -aq)| grep -o '[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+ 8000'|cut -d" " -f 1|sort -u
10.2.237.10
10.2.237.2
10.2.237.3
10.2.237.4
10.2.237.5
10.2.237.6
10.2.237.7
10.2.237.8
10.2.237.9

Adding the -n switch to the sort command fixes this:

docker inspect --format '{{ .HostConfig }}' $(docker ps -aq)| grep -o '[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+ 8000'|cut -d" " -f 1|sort -un|tail -1
10.2.237.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant