I am to start a docker container and bind an IPv6 address to it by running docker run -itd --restart=always --name=<container> --net=br6 --ip6=2001:db8:8:2::100 <image>. However, I have to use ndp proxy ip neigh replace proxy "2001:db8:8:2::100" dev ens3 to make the address accessible. Is it possible to run this command on the host machine every time when the docker container starts?

1 Answer 1


The easiest way, of course, is to put both commands inside a bash script, as part of the process.

Create the script run.sh:


docker run -itd --restart=always --name=<container> --net=br6 \          
--ip6=2001:db8:8:2::100 <image> . \
&& ip neigh replace proxy "2001:db8:8:2::100" dev ens3

Now everybody who wish to run your container should do it by running ./run.sh, after granting it executing permissions.

This is very common to use a script like to set up the environment before running.

But in some rare occasions (not like yours, though, but its completely up to you to decide) you want to make the host execute script automatically when the container starts.

This can be done by using the server-client pattern - your host serves as the server side - it is listening on specific port, and ready to execute the command on request.

The container acts as the client - in the container entrypoint, it sends an http request to the server, on that specific port and URI, asking it to execute the wanted command.

An example of using this pattern on docker is when debugging server code - you want the container to send the debugging logs to a specific port on your machine where your IDE accepts them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .