I’ve been looking for a good way to spin up a development environment with docker compose that allows for separate web and api service containers so that the web application can call into the api service over http.
I would like the set up to be dead simple so that developers just run compose ‘build’ and then ‘up’ without having to muck about with their local machine configuration on mac and linux.
Here’s our current docker-compose.yml:
version: "2" services: admin_web: image: app/admin-web:development build: context: ./admin-web dockerfile: Dockerfile.development volumes: - ./admin-web:/home/nodejs/app ports: - "3000:3000" links: - admin_api environment: - ADMIN_API_URL=http://admin_api:3001 admin_api: image: app/admin-api:development build: context: ./admin-api dockerfile: Dockerfile.development volumes: - ./admin-api:/home/nodejs/app ports: - "3001:3000"
Using ADMIN_API_URL from the web app, the problem is that because the http calls from the web application are being made from the browser, the network aliasing to admin_api doesn’t resolve using the networking aliases set up by docker.
Any recommendations for our development environment given the requirements of 1) zero additional developer machine configuration 2) using environment variables?
Thank you in advance!