pre_start containers don't inherit/support extra_hosts
Open
@ndeloof is already working on this.
Since Sep 15, 2026.
kind/feature
- Dominant language
- Go
- Stars
- 38.2k
- Forks
- 5.8k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 55
Description
Description
Hi, thanks for the awesome pre_start feature!
We're running into the problem that we 're not seeing extra_hosts in the pre_start containers being applied. For example:
services:
test:
image: busybox
extra_hosts:
- "somehost:162.242.195.82"
pre_start:
- command: cat /etc/hosts
command: cat /etc/hosts
Then, running docker compose up outputs:
laughing_hertz | 127.0.0.1 localhost
laughing_hertz | ::1 localhost ip6-localhost ip6-loopback
laughing_hertz | fe00:: ip6-localnet
laughing_hertz | ff00:: ip6-mcastprefix
laughing_hertz | ff02::1 ip6-allnodes
laughing_hertz | ff02::2 ip6-allrouters
laughing_hertz | 172.19.0.2 731eafcc9089
laughing_hertz exited with code 0
test-1 | 127.0.0.1 localhost
test-1 | ::1 localhost ip6-localhost ip6-loopback
test-1 | fe00:: ip6-localnet
test-1 | ff00:: ip6-mcastprefix
test-1 | ff02::1 ip6-allnodes
test-1 | ff02::2 ip6-allrouters
test-1 | 162.242.195.82 somehost
test-1 | 172.19.0.2 876dcd9db560
test-1 exited with code 0
The somehost is not visible in the laughing_hertz pre_start container.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.