Using custom hostnames for docker local development containers
I am playing around with Docker for Windows (just starting out) and have this simple docker-compose.yml which works great: version: '2.1' services: db: image: mysql:latest container_name: wordpresslab_db volumes: - db_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: wordpress MYSQL_USER: wordpress MYSQL_DATABASE: wordpress MYSQL_PASSWORD: wordpress phpmyadmin: image: phpmyadmin/phpmyadmin container_name: wordpresslab_phpmyadmin volumes: - /sessions ports: - "8090:80" depends_on: - db wordpress: image: wordpress:latest container_name: wordpresslab_wordpress volumes: - ./:/var/www/html ports: - "8080:80" depends_on: - db restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_PASSWORD: wordpress volumes: db_data: Once I run docker-compose up -d it creates the containers for database, phpmyadmin and wordpress website and are accessible and working OK. My question is, how could I setup "project.dev" instead of a "localhost:8080" to access wordpress site and "phpmyadmin.dev" instead of a "localhost:8090" to access phpmyadmin? What other tools do I need? Note that I am using Windows 10 as host.
I think you want to use port mapping as described in the networking doc. https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/container-networking#network-creation There's also a Docker doc on ports in compose files. https://docs.docker.com/compose/compose-file/#long-syntax Please note that there are differences in syntax depending on which version of docker compose you are using. You can check your version by running this command in a command prompt: docker-compose --version Let me know if you're still running into trouble!
Swarm scheduling not working as expected using filters in compose file
issues in buiding Slate with Docker
Invalid type error in Docker Compose
Django cookiecutter with Docker add pip package
Docker Compose + Swarm + Machine Networking issue
docker-compose build image parameters --force-rm --pull
linking 2 containers through docker compose
Files created by manage.py commands not chown'd from root user
Is it possible to create an intermediate image within docker-compose?
docker-compose service listen on specified interface
Does Docker-Compose allow overwriting of ports when using extends?
Jhipster Docker-compose conflict
Build multiple images with Docker Compose?
JHipster Cassandra Docker Build
Defining project name inside docker-compose configuration
Docker-compose named mounted volume