0

I'm trying to access a host port from a docker container running an OCaml stack. When I use the --net=host option when running the container I get the following error

Fatal error: exception # opam-version    1.2.2 (58ef3b8213100953848d362f7120a30356d7f77d)
# os              linux
opam: "execvp" failed on --net=host: No such file or directory

The contents of my /etc/hosts file are as follows

127.0.0.1   localhost
127.0.1.1   ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Could someone please explain why I could be getting this error?

EDIT

The docker command I'm using is docker run -it <repo-name> --net=host

2
  • 1
    please post your complete docker command Commented Jan 29, 2017 at 16:00
  • Updated the question with the docker command. Commented Jan 29, 2017 at 16:41

1 Answer 1

2

Docker parameters need to be listed before the container name. Otherwise they are interpreted as arguments of the container entrypoint. This should work:

docker run -it --network=host <repo-name>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.