Question

Docker compose not creating db

Hi,

I am following this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-laravel-nginx-and-mysql-with-docker-compose

I have set these vars in the docker-compose.yml

 MYSQL_DATABASE: laravel
 MYSQL_USER: laraveluser
 MYSQL_PASSWORD: laraveldbpassword
 MYSQL_ROOT_PASSWORD: root

But this is my public IP: http://178.62.89.151/

It is saying the database doesn’t exist, I have tried docker stop and rm on all containers then build, and docker-compose up -d but no joy?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

I could suggest a couple of things:

  • Check the logs of the database container, there you should be able to see any errors that could be preventing the container from starting or any other problems that occur during run.

First get the container ID:

docker ps -a

Then run the following to see the logs:

docker logs CONTAINER_ID
  • My guess would be that the password that you are using is too weak, I would suggest trying to use a stronger password and see how that goes.

Hope that this helps! Regards, Bobby