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.

  • Can't get docker running on Cloud9 IDE
  • Accessing host usb device in docker for windows
  • Docker Architecture for a test server
  • I start docker with a shell script but when the shell script exits, the container crashes
  • What server URL should one provide for TeamCity agent in Docker?
  • How to update Docker image when there is new image version?
  • 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.

  • Copying a once compiled folder from shared drive into own workspace in a docker image
  • Pushing to Docker Private Organization Repository
  • Can I release some memory of a running Docker container on the fly?
  • Dockerfile created for JBoss with MySQL image
  • libgit2 alpine linux docker error
  • Setting docker environment variable to existing environment variable with different name
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.