Tag: hosts

Docker-在Mac上编写extra_hosts

我试图添加一个新的主机到我的Nginx容器与Docker-compose的extra_hostsconfiguration。 出于某种原因,我不能使它工作。 我使用Docker for Mac 17.06 CE和Docker-Compose v3稳定。 这是我的configuration: nginx: build: ./docker/nginx container_name: nginx ports: – '80:80' volumes: – "${PROJECT_ROOT}:/var/www/html:ro" networks: – server extra_hosts: – 'test.local:127.0.0.1' depends_on: – php restart: always 我也尝试添加额外的主机与我的Mac的IP,但它不响应。 UPDATE 出于某种原因,您需要编辑Mac上的/ etc / hosts文件来添加新的主机。 extra_hostsconfiguration什么都不做。