dockermacoscolima

Custom docker container IP on macOS with Colima


I have the following docker-compose.yml file:

version: '3.7'

services:
  database:
    image: postgres:16.3
    restart: unless-stopped
    environment:
      POSTGRES_DB: app
      POSTGRES_USER: user
      POSTGRES_PASSWORD: password
    ports:
      - "127.42.90.84:5432:5432"
    volumes:
      - db:/var/lib/postgresql/data/
volumes:
    db:

I'm trying to use Colima with colima start --network-address, but can't reach the service from my local machine with the IP 127.42.90.84 - and I have honestly no idea why.

docker-compose ps: database-1 postgres:16.3 "docker-entrypoint.s…" database 9 minutes ago Up 9 minutes 127.42.90.84:5432->5432/tcp which should be correct

Anyone got an idea? Thanks


Solution

  • The feature has now been added to Colima https://github.com/abiosoft/colima/issues/492#issuecomment-2264657556.