What is the working directory of a Docker Golang application?

When I serve a Golang Application from within the official Docker Hub Repository I wonder what will be the default working directory the application starts up?

Background: I will have to map local Certificate Authority and server keys into the container to serve TLS https and I wonder where to map them to the application will be able to grab them in current working directory of the application from within the container?

  • Why am I unable to run django migrations via the 'docker-compose run web' command?
  • Docker, monitoring container status, alerts
  • How to aggregate logs for all docker containers in mesos
  • Docker: build using git push instead of ADD . /myapp
  • headless watir webdriver tests unable to find firefox
  • Tomcat 7 fails when starts in Debian, but continue working in background
  • Is it possible for a the host to authenticate to a KDC running on a Docker container?
  • Why shouldn't I run multiple processes in a Docker container?
  • Mac Docker Machine ZSH shell set env variable not applying
  • Docker doesn't resolve hostname
  • Bamboo+Docker+Kubernetes deployment
  • Copy a file from container to host during build process
  • 2 Solutions collect form web for “What is the working directory of a Docker Golang application?”

    If you are using the golang:1.X-onbuild image from DockerHub will be copied into(https://hub.docker.com/_/golang/)

    /go/src/app
    

    this means all files and directories from the directory where you run the

    docker build 
    

    command will be copied into the container.

    And the workdir of all images is

    /go
    

    Go will return the current working directory using

    currdir, _ = filepath.Abs(filepath.Dir(os.Args[0]))
    

    Executed within a golang container and right after startup, the pwd is set to

    /go/src/app
    

    The current working directory of a golang application starting up within a Docker container is thus /go/src/app. In order to map a file/directory into a container you will habe to use the -v-switch as described in the Documentation for run:

    -v /local/file.pem:/go/src/app/file.pem
    

    Will map a local file into the pwd of the dockerized golang app.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.