Skip to content

docker-compose.yml does not work #280

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

Closed
huaweichen opened this issue Feb 8, 2018 · 5 comments
Closed

docker-compose.yml does not work #280

huaweichen opened this issue Feb 8, 2018 · 5 comments

Comments

@huaweichen
Copy link

I just simply followed: https://hub.docker.com/r/_/wordpress/
section: "... via docker stack deploy or docker-compose"

version: '3.1'

services:

  wordpress:
    image: wordpress
    restart: always
    ports:
      - 8081:80
    environment:
      WORDPRESS_DB_PASSWORD: example

  mysql:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example

I've setup my docker-compose in ubuntu 16.04
version is: docker-compose version 1.16.1, build 6d1ac21

Then I run docker-compose stack.yml up -d.
Then I can see two container lauched:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
10f931f9ff08        mysql:5.7           "docker-entrypoint.s…"   4 minutes ago       Up 4 minutes        3306/tcp               wordpress_mysql_1
2337f1df60d7        wordpress           "docker-entrypoint.s…"   4 minutes ago       Up 10 seconds       0.0.0.0:8081->80/tcp   wordpress_wordpress_1

But if I go to browser:
localhost:8081
This site can’t be reached is displayed.

sigh

@andreccosta
Copy link

andreccosta commented Feb 8, 2018

Try and check the logs to see what might have gone wrong with docker-compose logs or simply remove the -d option from the up command so that you start the containers in attached mode instead.

@huaweichen
Copy link
Author

huaweichen commented Feb 9, 2018

Thanks for that, but here's the result and logs: docker-compose up // without -d

wordpress_1  | Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'172.18.0.3' (using password: YES) in Standard input code on line 22
wordpress_1  | 
wordpress_1  | MySQL Connection Error: (1045) Access denied for user 'root'@'172.18.0.3' (using password: YES)
wordpress_1  | 
wordpress_1  | Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'172.18.0.3' (using password: YES) in Standard input code on line 22
wordpress_1  | 
wordpress_1  | MySQL Connection Error: (1045) Access denied for user 'root'@'172.18.0.3' (using password: YES)
mysql_1      | 2018-02-09T01:48:29.963549Z 1822 [Note] Access denied for user 'root'@'172.18.0.3' (using password: YES)

@andreccosta
Copy link

Judging by the logs it just seems like a simple wrong password issue.
I can't reproduce it locally since copy/pasting the exact yml config from your first comment starts up without any issues.

I know it's unlikely but have you doubled checked that in your yml config the passwords do match?

@yosifkit
Copy link
Member

Also if you changed the database password env in the yaml, you need to delete the database container and volume for the change to take (since it is only used on first initialization) See docker-library/postgres#203 (comment) for info about a volume on a database when using compose.

@tianon
Copy link
Member

tianon commented Feb 10, 2018

Closing since this appears to be an issue with your environment or setup (and we can't reproduce).

In the future, these sorts of questions/requests would be more appropriately posted to the Docker Community Forums, the Docker Community Slack, or Stack Overflow.

@tianon tianon closed this as completed Feb 10, 2018
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

4 participants