Docker Community Forums

Share and learn in the Docker community.

Docker networking with bridge network as well host access

We are currently running docker on private subnet with a specified ip pool.

We now have a requirement to support access to a service running on the host running docker at http://169.254.169.254/latest/meta-data/ .

What is the best to bring up such a docker that is in a bridge network with a private ip pool and at the same time be able to query the host service running on the host? i.e have both bridge network and a route to access the service running at the above ip.

Can this be done during docker bring up using docker-py?

% docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 2
Server Version: 17.12.1-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local nvidia-docker
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9b55aab90508bd389d7654c4baf173a981477d55
runc version: 9f9c96235cc97674e935002fc3d78361b696a69e
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.137-0.1.ac.218.74.329.metal1.x86_64
Operating System:
OSType: linux
Architecture: x86_64
CPUs: 32
Total Memory: 480.3GiB
ID: HWAH:RWEY:HYGV:GOP4:3N5D:KE2L:UYKC:TAXD:L33P:2WJE:Y4DQ:NPSU
Docker Root Dir: /local/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false