Docker Community Forums

Share and learn in the Docker community.

How to bind a container ro

I m trying to setup a bind server in a docker host.
As it s very difficult to change ip of the dns server in all my computer i would like to “fix” the ip of my bind server.

Then i would like to specify the ip only for my bind server

then on my docker host i have the

eth0 with adresse
and a subinterface eth0.1 with adresse

i ran my docker with the following command

docker create --name bind-slave -p -p bind-slave.

The server answer to request on the adresse that s nice
but when it does the zone transfer it use the ip adresse.

then the command work nice for in going packet but not for out going packet.
then the bind on the ip adress is not complete.

is there a way to mimic more accurately the bind on an interface?

Some ideas,
I believe the True/False dictation may be useful, if you use “docker inspect” volumes come up as

“VolumesRW”: {
“/foo/bar/myvol”: true
…more stuff
though its not very informative, heres a sample of two ways, yours and another.

Your example

{"/home/host-data/": ("/mnt/data", False)}
change start () from

if binds:
bind_pairs = [
‘{0}:{1}’.format(host, dest) for host, dest in binds.items()
start_config[‘Binds’] = bind_pairs
to (setting rw if True is set, ro if False)

if binds:
bind_pairs = [
‘%s:%s:rw’ % (h,d[0]) if d[1] else ‘%s:%s:ro’ % (h,d[0]) for h, d in binds.items()]
start_config[‘Binds’] = bind_pairs
Or use more explicit keys

{"/home/host-data/": { “bind” : “/mnt/data”, “rw” : True }}
Then in the start() def we could change it to

if binds:
bind_pairs = [
‘%s:%s:rw’ % (h,d[‘bind’]) if d[‘rw’] else ‘%s:%s:ro’ % (h,d[‘bind’]) for h, d in binds.items()
start_config[‘Binds’] = bind_pairs

sorry there was some problem with the title of my post.

my problem is not about volume but about ip adress.

i need to bind my container only one one ip adress and not to use the other ip adress.