Connect docker container to VPN

a 夏天 提交于 2019-12-25 09:10:08

问题


I have a docker container from which I build and package a Java application with maven 3. I have some dependencies deployed to a Nexus server, I can only access through a VPN from local. How can I connect my docker container to that VPN?

docker image details:

Base image : Ubuntu 16.04 LTS as base system

Java 8, maven 3, Tomcat 8 installed

To create my docker container (I didn't add any network configuration):

docker run -it --rm -v '$PWD':/app -w /app/app-parent appImage/v:02 mvn clean install

And that's the error i get:

INFO: I/O exception (java.net.NoRouteToHostException) caught when processing request to {}->http://myserver:80: No route to host (Host unreachable)

回答1:


May be your problem is due to DNS only.

Try resolving nexus hostname in the container's /etc/hosts file (or change maven settings.xml so that tag of nexus repository looks for the ip instead of the hostname).

To check if that is the problem, simply connect to the container

docker exec -ti yourContainer /bin/bash

then try to contact the host (depending on what you installed on the container, you could use ping, wget or other) with hostaname and ip address.



来源:https://stackoverflow.com/questions/41483231/connect-docker-container-to-vpn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!