Skip to content

MacOS and Docker Desktop support

Maksym Zaporozhets edited this page Jan 7, 2024 · 1 revision

Install Dockerizer on MacOS

System requirements for Linux and MacOS are the same in terms of PHP version, extensions and Docker version. Installation process is also the same except for the 4th step. Instead of this command:

php "${DOCKERIZER_PROJECTS_ROOT_DIR}dockerizer_for_php/bin/dockerizer" composition:build-from-template \
    --template=traefik --required-services=traefik_host_network

Run this one:

php "${DOCKERIZER_PROJECTS_ROOT_DIR}dockerizer_for_php/bin/dockerizer" composition:build-from-template \
    --template=traefik --required-services=traefik_bridge_network

This will create a Docker composition with Traefik that will work on MacOS and Docker Desktop:

  • It will use the bridge Docker network mode instead of host mode.
  • It will bind ports 80 and 443 to the host machine.

This is required because Docker Desktop does not support host network mode due to running Linux virtual machine instead of using the host OS kernel.

You can still use all the same Bash aliases for ZSH.

Network traffic routing on MacOS and Docker Desktop

Since we use the bridge network mode on MacOS and Docker Desktop, the network traffic is routed differently than on Linux. There are two ways to access your applications:

  • Easy but dirty: connect all compositions to the traefik_bridge_network network. Unfortunately, in this case all containers will be able to access each other. This is highly not recommended because isolation is what developers should care about.
  • Recommended: connect Traefik container to all other compositions. This way it will be able to access all applications and route traffic to them. At the same time, other containers will not be able to access each other.

Manually connecting and disconnecting Traefik container to/from other compositions is not convenient. This is why we recommend to use the maintenance:traefik:update-networks command to automate this process. Run it once to connect/disconnect Traefik container to/from all other compositions or use it with the --watch option to automatically connect/disconnect Traefik container to/from new compositions. See the command description for more information.

MacOS: Docker images for MySQL 5.7 and earlier, Elasticsearch 7.7 and earlier

There are a few services that are not available on MacOS with M1 and later processors:

  • mysql_5_6_persistent and mysql_5_7_persistent
  • elasticsearch_7_6_2_persistent and elasticsearch_7_7_1_persistent

Ensure to enable Rozetta emulation in Docker Desktop settings to run these services. Dockerizer will automatically pull linux/amd64 images for these services if Docker arch is arm64 and image does not support it.

Clone this wiki locally