It work well for Version 2.3 since https://github.com/docker/compose/issues/5282 but invalid for Version 3
Is there a known workaround for this? Other than building the images outside of compose.
I'am using Version 2.3 for building images and other version for deploying.
Hi,
Is there any update on this? It feels like a real omission from v3 when it is supported by the docker --add-host command.
I really don't want to adjust our build process to building outside of compose, and I can't use version 2.3 because I lose support for other build aspects I need from 3?
A work around to pass --add-host would be great?
For the following Dockerfile:
FROM byrnedo/alpine-curl
The following docker-compose.yml works (if you replace host and IP with your case):
version: '2.3'
services:
tmp:
build:
context: .
extra_hosts:
- "host:IP"
command: -kIL https://host
tty: true
stdin_open: true
But the following fails (if you replace host and IP with your case):
version: '3'
services:
tmp:
build:
context: .
extra_hosts:
- "host:IP"
command: -kIL https://host
tty: true
stdin_open: true
The error at docker-compose up is:
The Compose file is invalid because:
services.tmp.build contains unsupported option: 'extra_hosts'
Any updates this would be very nice
Having this would be great. Currently doing weird hacks to circumvent this limitation... :(
is this on the radar as something to be fixed?
One more vote here for fixing this limitation. I was trying with 3.5 and the issue is still there
This was added to the compose 3.9 schema in https://github.com/docker/cli/pull/2517. The 3.9 schema is not yet released (will be together with the next 20.x release of docker), and will have to be implemented in docker-compose as well (as the docker CLI itself doesn't use the build section of compose files, and only uses docker-compose files for docker stack deploy).
I'm closing this issue here, but subscribe / participate on https://github.com/docker/compose/issues/7323 which is a ticket in the docker-compose repository for this
Most helpful comment
Hi,
Is there any update on this? It feels like a real omission from v3 when it is supported by the
docker --add-hostcommand.I really don't want to adjust our build process to building outside of compose, and I can't use version 2.3 because I lose support for other build aspects I need from 3?
A work around to pass
--add-hostwould be great?