How to create a php + mongodb container?

0

I would like to know how do I create a container where I can use mongodb in a php project? The way I'm doing does not work, I can not connect to the manager.

docker-compose.yml

version: "3.1" services:

mysql:
  image: mysql:5.7
  container_name: my-stuff-mysql
  working_dir: /application
  volumes:
   - ./infra/mysql:/var/lib/mysql
  environment:
          - MYSQL_ROOT_PASSWORD=root
          - MYSQL_DATABASE=db_my_stuff
          - MYSQL_USER=root
          - MYSQL_PASSWORD=root
  ports:
   - "33060:3306"

webserver:
  image: nginx:alpine
  container_name: my-stuff-webserver
  working_dir: /application
  volumes:
      - ./src:/application
      - ./infra/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
  ports:
   - "9000:80"

php-fpm:
  build: infra/php-fpm
  container_name: my-stuff-php-fpm
  working_dir: /application
  volumes:
    - ./src:/application
    - ./infra/php-fpm/php-ini-overrides.ini:/etc/php/7.2/fpm/conf.d/99-overrides.ini

mongodb:
  image: mongo:latest
  container_name: my-stuff-mongodb
  volumes:
   - ./infra/mongodb:/data/db
  environment:
          - MONGO_DATA_DIR=/data/db
          - MONGO_LOG_DIR=/dev/null
          - MONGODB_USER=root
          - MONGODB_PASS=root
  ports:
   - "27017:27017"

Dockerfile

FROM phpdockerio/php72-fpm:latest
WORKDIR "/application"

# Install selected extensions and other stuff
RUN apt-get update \
    && apt-get -y --no-install-recommends install  php7.2-mysql php-mongodb \
    && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* \
    
asked by anonymous 03.02.2018 / 22:51

0 answers