-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'extra_hosts' not working anymore in 'docker stack deploy' #4859
Comments
It looks like docker compose config
name: extra_hosts
services:
app:
extra_hosts:
- host.docker.internal=host-gateway
image: nginx:alpine
networks:
default: null
networks:
default:
name: extra_hosts_default We should look indeed why the option from the compose-file doesn't work with docker stack config -c docker-compose.yaml
version: "3.8"
services:
app:
extra_hosts:
- host.docker.internal:host-gateway
image: nginx:alpine docker stack config -c docker-compose.yaml || docker stack deploy -c - mystack
docker service inspect --format '{{json .Spec.TaskTemplate.ContainerSpec.Hosts }}' mystack_app
["host-gateway host.docker.internal"]
docker exec mystack_app.1.sz17bandwnt1mqefp8dk0ngis sh -c 'cat /etc/hosts'
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
10.0.2.3 8c560fd34766 |
@robmry PTAL |
The extra_hosts entry is working correctly with Sidenote: in real world I'm using the command to merge multiple docker files, like: |
The |
This change to the compose file format compose-spec/compose-go#499 means we need a matching change for |
Description
So far, it was possible to pass docker compose config output to docker stack deploy without problems.
Today I upgraded to docker 25.0.2, and discovered loss of the extra_hosts mapping. The tag is completely ignored with the command, and nothing is written to /etc/hosts anymore!
This might be related to:
compose-spec/compose-go#499
compose-spec/compose-spec#156
docker/buildx#2201
Reproduce
cat docker-compose.yml
Run:
Expected behavior
/etc/hosts
should show the entry fromextra_hosts
.docker version
Client: Docker Engine - Community Version: 25.0.2 API version: 1.44 Go version: go1.21.6 Git commit: 29cf629 Built: Thu Feb 1 00:23:19 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 25.0.2 API version: 1.44 (minimum version 1.24) Go version: go1.21.6 Git commit: fce6e0c Built: Thu Feb 1 00:23:19 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.28 GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Additional Info
No response
The text was updated successfully, but these errors were encountered: