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

Can not connect to database #3

Open
adiatma85 opened this issue Apr 17, 2022 · 1 comment
Open

Can not connect to database #3

adiatma85 opened this issue Apr 17, 2022 · 1 comment

Comments

@adiatma85
Copy link

Hello @victorsteven , first, I like to say thank you about the tutorial that you write here

I have some kind of problem when use this repository as reference, when I run docker-compose up
the app can not run and have error messages like this
image

In docker-compose.yml, the configuration is like this

fullstack-mysql:
    image: mysql:5.7
    container_name: full_db_mysql
    ports: 
      - 3306:3306
    environment: 
      - MYSQL_ROOT_HOST=${DB_HOST} 
      - MYSQL_USER=${DB_USER}
      - MYSQL_PASSWORD=${DB_PASSWORD}
      - MYSQL_DATABASE=${DB_NAME}
      - MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
    volumes:
      - database_mysql:/var/lib/mysql
    networks:
      - fullstack

(It's sync with .env file)
I can not figure out why I found error while running docker-compose, but I can assure that mysql container is running

Any one have a lead why this is happen?
Thanks in advance

@adiatma85
Copy link
Author

Somehow, it's resolved itself.

I kinda somehow figured what happen, maybe it's because I forgot do run docker-compose up --build

The container kinda piled up with another container. So to make sure it doesn't conflict with another container, what I am doing is:

  • Make sure that there is separate container
  • If there is not exist, run docker-compose up with --build flag

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