Nginx-proxy: Projects appears to be in conflict. At every F5 the result is different.

Created on 21 Jan 2018  路  3Comments  路  Source: nginx-proxy/nginx-proxy

I would like to run two projects using the nginx-proxy network. When I start only one project, it works normally. But when I start both, the result is very intermittent. If I press F5 it says it has failed to connect to the mysql service. If I press F5 again it says there was an error in the query. Sometimes it works normal. But if I press F5 to stop working again.

Taking advantage of the issue, I would like to know if it is the best way to run multiple projects on the same server. Or it's just a solution for anyone who wants to run multiple projects on the same server because the best solution is a docker project per server. I'm kind of confused about that.

Here my docker-compose.yml. The second project is similar changing ports and project paths only.

version: "3.1"
services:

    memcached:
      image: memcached:alpine
      container_name: project-memcached

    mysql:
      image: mysql:5.6
      container_name: project-mysql
      working_dir: /application
      volumes:
        - .:/application
        - ./phpdocker/mysql-data:/var/lib/mysql
      environment:
        - MYSQL_ROOT_PASSWORD=root
        - MYSQL_DATABASE=project
        - MYSQL_USER=project
        - MYSQL_PASSWORD=docker
      ports:
        - "33066:3306"

    webserver:
      image: nginx:alpine
      expose: [80]
      restart: always
      container_name: project-webserver
      working_dir: /application
      volumes:
          - .:/application
          - ./phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
      environment:
        - VIRTUAL_HOST=project.local

    php-fpm:
      build: phpdocker/php-fpm
      container_name: project-php-fpm
      working_dir: /application
      volumes:
        - .:/application
        - ./phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/7.1/fpm/conf.d/99-overrides.ini

networks:
  default:
    external:
      name: nginx-proxy

docker-compose.yml for proxy:

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

networks:
  default:
    external:
      name: nginx-proxy

Thanks advance!

Most helpful comment

Hey @Soufraz, I have a similar issue with 2 projects running at the same time. Could you share the solution to your problem? I know it's a long shot but it might help me. Thanks.

All 3 comments

Hey @Soufraz, I have a similar issue with 2 projects running at the same time. Could you share the solution to your problem? I know it's a long shot but it might help me. Thanks.

I have the same similar issue with 2 projects. I think it's only database that make data random. Any explain ? Volumes or network ? Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Jas2Ma picture Jas2Ma  路  4Comments

nickjanssen picture nickjanssen  路  3Comments

kevindesousa picture kevindesousa  路  3Comments

Giymo11 picture Giymo11  路  3Comments

sjawhar picture sjawhar  路  4Comments