Sign inSign up

miovision/local-proxy

By miovision

•Updated about 7 years ago

Proxies traffic to a port on the local machine

Image
0

300

miovision/local-proxy repository overview

⁠Local Proxy

This container acts as a small proxy to easily allow your docker containers to route requests to your host machine. The idea is that this container does all the heavy lifting so that you can make your developer container setup as close to production as possible. This image works on both Mac and Linux.

⁠Usage

Here is an example docker-compose file. There are a couple things going on here. First ports 443 and 80 are open on the local-proxy container. This lets you send both http and https requests and have them forwarded to the specified port (in this case 8080) as http.

services:
  local-proxy:
    image: miovision/local-proxy
    ports:
      - "80"
      - "443"
    command: "8080" #What port to proxy requests to on the host machine.
    networks:
      main:

networks:
  main:

We also do another trick and add a network main with default settings. This let's us do other things like create network aliases for the local proxy. If we add the following to our local-proxy definition

    networks:
      main:
        aliases:
          - my-cool-service.com

Any container part of the main network who send requests to my-cool-service.com will now send those requests to that container instead. This lets you specify the same hostnames as you would in production so you can leverage the exact same docker configurations and remove the need for custom developer configurations.

Tag summary

Content type

Image

Digest

Size

67 MB

Last updated

about 7 years ago

docker pull miovision/local-proxy