vendredi 5 mai 2017

Easy way to give docker container access to my local domains (.local, .dev)

I´m using docker for local development and need to generate PDFs with snappy, snappy loads parts based on urls and on my local machine urls look like this: test.local (pointing to 127.0.0.1 in my hosts file).

My container setup can't reach these urls and I can't find an easy solution. Best way would be something like an access for docker to the systems hosts file config or something similar.

My actual docker compose file looks like this:

version: '3'

services:
  nginx:
    build: ./nginx/image
    volumes:
      - ./nginx/conf.d:/etc/nginx/conf.d
      - ./nginx/logs:/var/log/nginx
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./..:/usr/share/nginx/html
    ports:
      - "80:80"
  phpfpm:
    build: ./php/image
    volumes:
      - ./..:/usr/share/nginx/html
      - ./php/php.ini:/usr/local/etc/php/php.ini
      - ./php/log:/var/log
      - ./php/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf
    ports: 
      - "9000:9000"
  mysql:
    image: mariadb
    volumes:
      - mariadb:/var/lib/mysql
      - ./..:/usr/share/nginx/html
    ports:
      - "3306:3306"
    environment:
      MYSQL_DATABASE: default
      MYSQL_USER: root
      MYSQL_PASSWORD: secret
      MYSQL_ROOT_PASSWORD: root
volumes:
  mariadb:
    driver: "local"

Any ideas? I´m using Windows 10.




Aucun commentaire:

Enregistrer un commentaire