mumoshu / dcind

Docker Compose (and Daemon) in Docker
12 stars 15 forks source link

docker network not recognizing my container #4

Closed fewknow closed 6 years ago

fewknow commented 6 years ago

I am using this to test liquibase to postgress with a docker-compose.yml

version: '3'
services:

    postgres:
      container_name: postgres
      image: "postgres:9.6"
      environment:
        POSTGRES_PASSWORD: testing
        POSTGRES_USER: corvesta
      volumes:
        - ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
      ports:
        - "5432:5432"

    liquibase:
      container_name: Liquibase
      image: "kilna/liquibase-postgres"
      environment:
        LIQUIBASE_HOST: postgres
        LIQUIBASE_PORT: 5432
        LIQUIBASE_DATABASE: %%DATABASE%%
        LIQUIBASE_USERNAME: corvesta
        LIQUIBASE_PASSWORD: testing
        LIQUIBASE_CHANGELOG: changelog.xml
        LIQUIBASE_LOGLEVEL: debug
        LIQUIBASE_CLASSPATH: /opt/jdbc/postgres-jdbc.jar
        LIQUIBASE_DRIVER: org.postgresql.Driver
        LIQUIBASE_DEBUG: unset
      volumes:
        - ./postgres/wait-for-postgres.sh:/workspace/wait-for-postgres.sh
        - ./postgres/changelog.xml:/workspace/changelog.xml
        - ./postgres/scripts:/workspace/scripts
      networks:
        - toolslocaldev_default
      command: ["./wait-for-postgres.sh", "postgres", "liquibase update"]

networks:
  toolslocaldev_default:
    external:
      name: toolslocaldev_default

when the "./wait-for-postgres.sh", "postgres" runs it attempts to connect to postgres which locally works because docker-compose is setting the DNS resolution.

I am seeing this when trying in my concourse-ci pipeline

Liquibase    | Postgres is unavailable - sleeping
Liquibase    | psql: could not translate host name "postgres" to address: Name does not resolve
Liquibase    | Postgres is unavailable - sleeping
Liquibase    | psql: could not translate host name "postgres" to address: Name does not resolve
Liquibase    | Postgres is unavailable - sleeping

Is there any reason this shouldn't work with your DCIND container?

Thanks

fewknow commented 6 years ago

I did just notice this in the logs LOG: could not create IPv6 socket: Address family not supported by protocol

fewknow commented 6 years ago

Found the mistake..thanks