Skip to main content
se añadieron 1581 caracteres en el cuerpo
Origen Enlace
Juan Pablo B
  • 936
  • 10
  • 29
  version: '3.7' 

services:
### PHP Container #########################################
  nadal:
    container_name: findra_nadal
    hostname: nadal
    build:
      context: ./nadal
      dockerfile: Dockerfile
    restart: unless-stopped
    working_dir: /var/www/html/app
    volumes:
      - ./nadal:/var/www/html/app
    depends_on:
      - mysql
      - redis
    networks:
      - composerbackend

### NGINX Container #########################################
  nginx:
    container_name: findra_nginx
    hostname: nginx
    image: nginx:1.17
    tty: true
    restart: unless-stopped
    depends_on:
      - nadal
    ports:
      - 5023:80
    volumes:
      - nadal:/var/www/html/app
      - ./nadal/docker/virtualhost.conf:/etc/nginx/conf.d/default.conf
    networks:
      - backend
### MySQL Container #########################################
  mysql:
    container_name: findra_mysql
    hostname: mysql
    image: mysql:8.0
    environment:
      MYSQL_DATABASE: nadal
      MYSQL_USER: nadal-user
      MYSQL_PASSWORD: secret
      MYSQL_ROOT_PASSWORD: secret
    restart: always
    ports:
      - 33069:3306
    volumes:
      - mysql-data:/var/lib/mysql
#      - ./mysql/my.cnf:/etc/mysql/my.cnf
    networks:
      - backend

### Redis Container #########################################
  redis:
    container_name: findra_redis
    hostname: redis
    image: redis:5.0
    expose:
      - 6379
    networks:
      - backend

### Composer Container #########################################
  composer:
    container_name: findra_composer
    hostname: composer
    image: composer:1.8
    command: install["install --ignore-platform-reqsreqs", "dump-autoload --optimize"]
    volumes:
      - ./nadal:/var/www/html/app
    working_dirnetworks: /var/www/html/app
      - backend


### Networks Setup ##########################################
networks:
  backend:
    driver: bridge

### Volumes Setup ##########################################
volumes:
  nadal:
  mysql-data:
 backend   driver: "local"
  nginx-data:
    driver: "local"
version: '3.7'
services:
### PHP Container #########################################
  nadal:
    container_name: findra_nadal
    hostname: nadal
    build:
      context: ./nadal
      dockerfile: Dockerfile
    restart: unless-stopped
    working_dir: /var/www/html/app
    volumes:
      - ./nadal:/var/www/html/app
    depends_on:
      - mysql
      - redis
      - composer
    networks:
      - backend
### Composer Container #########################################
  composer:
    container_name: findra_composer
    hostname: composer
    image: composer:1.8
    command: install --ignore-platform-reqs
    volumes:
      - nadal:/var/www/html/app
    working_dir: /var/www/html/app
    networks:
      - backend
  version: '3.7' 

services:
### PHP Container #########################################
  nadal:
    container_name: findra_nadal
    hostname: nadal
    build:
      context: ./nadal
      dockerfile: Dockerfile
    restart: unless-stopped
    working_dir: /var/www/html/app
    volumes:
      - ./nadal:/var/www/html/app
    depends_on:
      - mysql
      - redis
    networks:
      - backend

### NGINX Container #########################################
  nginx:
    container_name: findra_nginx
    hostname: nginx
    image: nginx:1.17
    tty: true
    restart: unless-stopped
    depends_on:
      - nadal
    ports:
      - 5023:80
    volumes:
      - nadal:/var/www/html/app
      - ./nadal/docker/virtualhost.conf:/etc/nginx/conf.d/default.conf
    networks:
      - backend
### MySQL Container #########################################
  mysql:
    container_name: findra_mysql
    hostname: mysql
    image: mysql:8.0
    environment:
      MYSQL_DATABASE: nadal
      MYSQL_USER: nadal-user
      MYSQL_PASSWORD: secret
      MYSQL_ROOT_PASSWORD: secret
    restart: always
    ports:
      - 33069:3306
    volumes:
      - mysql-data:/var/lib/mysql
#      - ./mysql/my.cnf:/etc/mysql/my.cnf
    networks:
      - backend

### Redis Container #########################################
  redis:
    container_name: findra_redis
    hostname: redis
    image: redis:5.0
    expose:
      - 6379
    networks:
      - backend

### Composer Container #########################################
  composer:
    container_name: findra_composer
    hostname: composer
    image: composer:1.8
    command: ["install --ignore-platform-reqs", "dump-autoload --optimize"]
    volumes:
      - ./nadal:/var/www/html/app
    networks:
      - backend


### Networks Setup ##########################################
networks:
  backend:
    driver: bridge

### Volumes Setup ##########################################
volumes:
  nadal:
  mysql-data:
    driver: "local"
  nginx-data:
    driver: "local"
Origen Enlace
Juan Pablo B
  • 936
  • 10
  • 29

Comunicación entre componentes docker compose

Tengo una aplicacion el Laravel y otra en React que quiero automatizar con Docker. En el docker compose tengo todos los containers necesarios: php, nginx, mysql y estoy agregando tambien composer, pero tengo el problema que al correr el dockerfile y hacer composer install tira el siguiente error:

the command '/bin/sh -c composer install' returned a non-zero code: 127

El docker compose:

version: '3.7'
services:
### PHP Container #########################################
  nadal:
    container_name: findra_nadal
    hostname: nadal
    build:
      context: ./nadal
      dockerfile: Dockerfile
    restart: unless-stopped
    working_dir: /var/www/html/app
    volumes:
      - ./nadal:/var/www/html/app
    depends_on:
      - mysql
      - redis
      - composer
    networks:
      - backend
### Composer Container #########################################
  composer:
    container_name: findra_composer
    hostname: composer
    image: composer:1.8
    command: install --ignore-platform-reqs
    volumes:
      - nadal:/var/www/html/app
    working_dir: /var/www/html/app
    networks:
      - backend

y el dockerfile estoy probando que ande y tengo lo siguiente:

FROM php:7.2-fpm

MAINTAINER AsadoDev

# Install dependencies
RUN apt-get update && apt-get install


# Copy existing application directory contents
COPY . /var/www/html/app

WORKDIR /var/www/html/app

RUN composer install

EXPOSE 9000
CMD ["php-fpm"]