After upgrading to 17.06 I receive the following error when running docker-compose up
Recreating 3976a0934e55_3976a0934e55_3976a0934e55_api_web_1 ... error
ERROR: for 3976a0934e55_3976a0934e55_3976a0934e55_api_web_1 Cannot create container for service web: invalid IP address in add-host: "db"
ERROR: for web Cannot create container for service web: invalid IP address in add-host: "db"
ERROR: Encountered errors while bringing up the project.
Rolling back to 17.03.1-ce fixes this error. Any idea what is causing this?
Please share your Compose file(s).
web:
build: .
ports:
- "8878:80"
volumes:
- .:/var/www/my-api
links:
- db
extra_hosts:
- "db:db"
environment:
- TERM=xterm
db:
image: mysql:5.6.22
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=mydatabasename
- MYSQL_USER=root
- MYSQL_PASSWORD=password
ports:
- "3333:3306"
That is not a valid extra_hosts entry (it should be host:IP). The good news is you can omit it entirely, since links already does what you're trying to do.
Ah, guess I was confused why this broke after upgrading? Glad to know it is just an error on my end though.
My guess would be that the new engine release has additional checks on the extra_hosts field.
Most helpful comment
That is not a valid
extra_hostsentry (it should behost:IP). The good news is you can omit it entirely, sincelinksalready does what you're trying to do.