Adds static host entries inside the container.
Section: Resource and Runtime Controls
Inject extra hosts
yaml
yaml
services:
app:
image: myapp:latest
extra_hosts:
- "host.docker.internal:host-gateway"Explanation
Helpful for connecting back to services on the Docker host.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Resource and Runtime Controls
Raise ulimits
Sets per-container ulimits for file handles and similar resources.
Named volume for persistent data
Stores database data in a managed named volume.