Couldn't resolve host within docker container and java process

I am facing an issue running a docker image based on alpine linux that runs a java process (GoCD server). The java process itself tries to run some code to clone a git repository locally however I am getting a Couldn't resolve host exception. I tried to manually clone the git repo from within the container using ‘git clone’ and had no issue.

In addition, I am able to ping the domain from within the docker container by running ping with no issues and also from the host machine with the same result. It seems java has some difficulties resolving the name but I am not sure how to fix it.

  • How do I run JUnit tests in a Docker container and have the container fail startup when JUnit fails?
  • Does a docker container launched from Docker-in-Docker container inherit orphan/zombie reaping from the docker-in-docker container?
  • Howto assign second ip to docker container with ip:port:port
  • Single file volume mounted as directory in Docker
  • how can I change docker storage driver to devicemapper on mac
  • How can I specify an Alternate Exposed Port for Redis / RethinkDB (using Docker Compose)?
  • I tried creating a new image with RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf. I read in another question that would fix it but no luck. The whole Dockerfile looks like the following:

    FROM gocd/gocd-server:v17.5.0
    RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf
    ADD json-config-plugin-0.2.jar /godata/plugins/external/json-config-plugin-0.2.jar
    ENTRYPOINT ["/"]

    I am running on AWS ECS, ipv4 forwarding is set to 1 and network mode is bridge. I am running out of ideas.

  • How to connect to mongodb using docker-compose?
  • “line 36: cd: HOME not set” in running Boot2Docker installed using Docker for Windows Installer v1.6.0
  • Pbs with python tempfile.mkdtemp in gitlab-ci docker
  • The docker compose will remain legacy volumes and couldn't now clear them
  • Jenkins Slave can't read settings.xml
  • Using Docker to load Memory Image?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.