How to start two Docker containers nginx locally

58 views Asked by At

I am trying to start with with docker-compose up -d two docker containers, but it starts only one, I need to start other too. Is there any way to do that in localhost, or if I can start in on other port, how to do that?

First project nginx:

 nginx:
    image: nginx:alpine
    volumes:
      - ${APP_PATH_HOST:-./}:/var/www/html
      - .docker/nginx/default:/etc/nginx/conf.d/default.conf
      - ./localhost.crt:/etc/ssl/certs/localhost.crt
      - ./localhost.key:/etc/ssl/private/localhost.key
    ports:
      - "${HOST_HTTP_PORT:-80}:80"
      - "443:443"
    depends_on:
      - php-fpm
    networks:
      - app-network

Second project:

nginx:
    image: nginx:alpine
    volumes:
      - ${APP_PATH_HOST:-./}:/var/www/html
      - .docker/nginx/default:/etc/nginx/conf.d/default.conf
      - ./localhost.crt:/etc/ssl/certs/localhost.crt
      - ./localhost.key:/etc/ssl/private/localhost.key
    ports:
      - "${HOST_HTTP_PORT:-8080}:80"
      - "4430:443"
      - "2022:2022"
    depends_on:
      - laraphp-fpm
    networks:
      - proxynet

UPDATE: I solved just adding in second project .env HOST_HTTP_PORT=90, and now one is on port 80, and second on 90. It works.

0

There are 0 answers