instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.72k stars 2.53k forks source link

Docker setup on MacOS broke my other Docker setups due to installed proxy #2411

Open jamesalvarez opened 2 months ago

jamesalvarez commented 2 months ago

Summary:

I tried to install a test environment using Docker. It didn't work, and furthermore made global settings changes, including dinghy proxy which installs itself in localStorage on localhost, which prevented the rest of my docker setups working. MacOS 14.4.1

Steps to reproduce:

  1. Run docker_dev_setup.sh

Expected behavior:

docker_dev_setup.sh install should install docker resources in standard way that can be spun up and down with docker-compose, and not interfere with global docker setup.

Actual behavior:

docker_dev_setup.sh install installs various undocumented settings and tweaks to global Docker setup (including dinghy http-proxy). Reinstall of docker required, and manual resetting of browser localStorage.

Additional notes:

docker_dev_setup.sh doesn't work, it fails at yarn install as per https://github.com/instructure/canvas-lms/issues/2313 and suggested fixes/patches did not work.

jamesalvarez commented 2 months ago

The issues lie in dinghy_proxy_setup.sh The script starts a Docker container using the codekitchen/dinghy-http-proxy image.

The container is configured to bind the following host machine ports: 80:80 for HTTP 443:443 for HTTPS 19322:19322/udp for DNS over UDP

This essentially makes these ports unavailable for any other container or application that needs to bind to these ports locally, causing a conflict, which would not be an issue if the proxy shut down with docker-compose down, but this doesn't happen - see the following:

Loopback Alias:

The script ensures that the IP 192.168.42.42 is added as an alias on the lo0 interface of the host machine. This is done to route local .docker domain traffic via this IP. However, this configuration causes further conflicts in networking for other Docker instances that expect traffic to flow through the default Docker network settings on localhost (127.0.0.1).

Persistent Loopback Configuration:

The script creates a plist file to persist the lo0 alias across reboots. This ensures that the proxy settings remain active, perpetuates the issue of port conflicts even after a system restart.

Resolver Configuration:

It modifies DNS resolution by creating a resolver file for the .docker TLD, ensuring that requests to domains ending in .docker are routed to the proxy. This setup interferes with other development setups that rely on standard DNS resolution or different internal DNS configurations.