Rudziankoŭ
Rudziankoŭ

Reputation: 11251

Allow docker container to access the internet

I would like my app inside docker to have access to the whole internet via host-machine.

I know that I can add particular ip --add-host=docker:10.6.210.32 But how can I add everything?

Upvotes: 10

Views: 43141

Answers (1)

sanath meti
sanath meti

Reputation: 6539

You can use --net=host in docker run command

docker run --net=host -it ubuntu

Else add dns in config file in /etc/default/docker

DOCKER_OPTS="--dns 208.67.222.222 --dns 208.67.220.220" 

for more info refer: http://odino.org/cannot-connect-to-the-internet-from-your-docker-containers/

Upvotes: 26

Related Questions