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!
compose extend file results in a validation error
hubot rocketchat adapter does not work
Docker compose lables constraint:node not work
is it possible to generate a random mysql password with dockercompose
Networking Docker Compose
How to change the config file for Riak TS when using Docker
Django Docker-compose machine does not start web server
How should docker-compose jobs discover etcd?
docker compose adding nodes dynamically to nginx frontend
Docker Swarm - dependencies definition
docker-compose volume not mounted
Exposing sentry service in docker-compose file
Yesod and docker-compose logs in development mode
Docker compose to always deploy using latest image
JHipster - Doubts in the development using Microservices Architecture
Gogs + Drone getsockopt: connection refused