1

I have a docker- compose file for my local development. At this moment it works fine. the only thing is I find it annoying to manually change the ip corresponding to my local app hostname in my machine hosts file (/etc/hosts in ubuntu). I need to access the application with a hostname because the application has subdomains (so http://localhost is definitely not enough). Is there a solution for this? Here is mo docker-compose file:

version: '2'
services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    image: myexampleapp
    ports:
        - 8080:80
    tty: true
    volumes:
      - .:/var/www/example
    links:
      - mysql
  mysql:
    image: mysql:5.7.22
    ports:
      - 33060:3306
    environment:
      MYSQL_DATABASE: test
      MYSQL_ROOT_PASSWORD: dev
    volumes:
      - ./data:/var/lib/mysql

Thanks

Karim Mtl
  • 1,223
  • 3
  • 11
  • 39
  • Possible duplicate of [Access docker container from host using containers name](https://stackoverflow.com/questions/37242217/access-docker-container-from-host-using-containers-name) – Paul Oct 01 '18 at 01:39
  • Why not point your fqdn to 127.0.0.1 instead of the container ip? – BMitch Oct 01 '18 at 02:06

0 Answers0