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

Config in separate docker-compose.yml #714

Closed
marucjmar opened this Issue Feb 12, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@marucjmar
Copy link

marucjmar commented Feb 12, 2017

Hi,

when run docker-compose.prod.yml with this config, site work

 services:
  db:
   volumes:
     ....
   environment:
     MYSQL_ROOT_PASSWORD: ...
     MYSQL_DATABASE: ...
     MYSQL_USER: ...
     MYSQL_PASSWORD: ...

  wordpress:
    volumes:
      -  ....
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_PASSWORD: ....
      VIRTUAL_HOST: fooo.com
      VIRTUAL_PORT: 80
  nginx-proxy:
    restart: always
    image: jwilder/nginx-proxy
    container_name: nginx-proxy
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro

But when my docker-compose.prod.yml separate to two file:

/docker-compose.prod.yml

version: '2'

services:
  db:
   volumes:
     ....
   environment:
     MYSQL_ROOT_PASSWORD: ...
     MYSQL_DATABASE: ...
     MYSQL_USER: ...
     MYSQL_PASSWORD: ...

  wordpress:
    volumes:
      -  ....
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_PASSWORD: ....
      VIRTUAL_HOST: fooo.com
      VIRTUAL_PORT: 80

and

/nginx/docker-compose.yml

version: '2'
services:
  nginx-proxy:
    restart: always
    image: jwilder/nginx-proxy
    container_name: nginx-proxy
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro

Site not work and display default nginx page, or 503

.conf like this

upstream 2075d816b463193acbe6d624b2e2c651933d4299 {
}
server {
	server_name fooo.com;
	listen 80 ;
	access_log /var/log/nginx/access.log vhost;
	location / {
		proxy_pass http://2075d816b463193acbe6d624b2e2c651933d4299;
	}
}

Could help me?

Command to run my compose

docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
@phelpsiv

This comment has been minimized.

Copy link

phelpsiv commented Feb 12, 2017

Are the containers on the same docker network?

@marucjmar

This comment has been minimized.

Copy link
Author

marucjmar commented Feb 12, 2017

@phelpsiv thanks, I solve this problem add this config:

docker-compose.prod.yml

version: '2'

services:
  db:
   volumes:
     ....
   environment:
     MYSQL_ROOT_PASSWORD: ...
     MYSQL_DATABASE: ...
     MYSQL_USER: ...
     MYSQL_PASSWORD: ...

  wordpress:
    volumes:
      -  ....
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_PASSWORD: ....
      VIRTUAL_HOST: fooo.com
      VIRTUAL_PORT: 80
    networks:
      - default
      - nginx_default

networks:
  nginx_default:
    external:
      name: nginx_default

Nice! #Close!

@marucjmar marucjmar closed this Feb 12, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.