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

Potential bug on Ubuntu 14 #4

Open
dwmkerr opened this issue Jun 12, 2016 · 16 comments
Open

Potential bug on Ubuntu 14 #4

dwmkerr opened this issue Jun 12, 2016 · 16 comments

Comments

@dwmkerr
Copy link
Owner

dwmkerr commented Jun 12, 2016

It seems there is a bug affecting some people, see:

http://www.dwmkerr.com/learn-docker-by-building-a-microservice/#comment-2716205460

For details.

Possible things to check:

  1. Docker version
  2. OS version
  3. MySQL version
@EliasJorgensen
Copy link

When i run start.sh i get the following message:

Starting DB...
2a04c50aae663c52bb6cdf5f8ca3516a9e32b016c018854c8b01b26a03b73812
Waiting for DB to start up...
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Got error: Access denied for user 'users_service'@'localhost' (using password: YES)
Setting up initial data...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'users_service'@'localhost' (using password: YES)

I'm on Ubuntu 16.04 LTS.
Docker version 1.11.2, build b9f10c9.
Latest version of the MySQL image.

@rohanliston
Copy link

Same thing here.

Ubuntu 16.04 LTS
Docker version 1.11.1, build 5604cbe
mysql:latest

@ElijahLynn
Copy link

Same here, when I checkout step1 or step2.

If I run the start command manually on the CLI it does work. It seems related to the environment variables not being ready in time.

Docker version 1.7.1, build 786b29d

image

@dwmkerr
Copy link
Owner Author

dwmkerr commented Jun 28, 2016

Hi @ElijahLynn interesting that you mention the environment variables - what makes you think they might not be ready in time? A timing issue could indeed be the root cause as it seems inconsistent and doesn't affect many users

@ElijahLynn
Copy link

Hi @dwmkerr, I say that because after the container is started, the users_service user is present and can login with the password specified. At least that is what I remember a week or so ago. I will double check.

@ElijahLynn
Copy link

Yes, immediately after I get the error messages in #4 (comment) I run docker exec -it db bash && mysql -p123 && select user from mysql.users; and I get two users, root and users_service.

I also just upgraded to Docker version 1.11.2, build b9f10c9.

image

@ElijahLynn
Copy link

I can also run the command in the script docker exec db mysqladmin --wait=30 -uusers_service -p123 ping immediately after and I get 'mysqld is alive'.

@ElijahLynn
Copy link

Okay, so it appears that if we add a sleep 10 right after the run command then the script works. Worth noting that <= 9 seconds it fails.

@ElijahLynn
Copy link

Maybe some systems are just faster at initializing the container and MySQL and that is why some have the issue and some don't. Odd though, I am on a pretty fast system, 8 core, 32GB ram, Intel SSD etc. Maybe my config is not optimal if this is the culprit.

@dwmkerr
Copy link
Owner Author

dwmkerr commented Jul 3, 2016

Well done for finding a solution @ElijahLynn - I'll update the write-up and code

@ElijahLynn
Copy link

Cool, it may not work on some systems that are slower, maybe put a comment in there saying some may need to increase the sleep if they get access denied errors.

@oschrenk
Copy link

oschrenk commented Aug 1, 2016

Not specific to Ubuntu. This also happens on Docker for Mac 1.12. Adding the sleep command helps.

@mdender
Copy link

mdender commented Aug 1, 2016

@ElijahLynn thanks, I'm on OSX and adding that sleep solved the issue for me.

@That-David-Guy
Copy link

That-David-Guy commented Aug 8, 2016

Bugs out for me on step 2. Sleep doesn't do anything. This is what I've added to my start.sh. (I'm on a macbook air)

@That-David-Guy
Copy link

...
echo "Sleep to fix race condition"
docker exec db sleep 10
...

@That-David-Guy
Copy link

Correction, docker exec db sleep 30 worked. 10 seconds mustn't of been enough for me :(

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

7 participants