docker run complains file not found

I am running following command for build docker image from /etc/docker and all files I want to copy inside the container are at this same location

docker build -t user/testapp .

Following is the content of my Dockerfile:-

  • How to stop/start logstash service running in docker
  • Docker API : Show container logs in a webpage
  • Docker for mac - Not able to connect to a mongo replica set running on host from inside the container
  • How to read environment variables during a docker image build process?
  • libcontainer, runc and nsenter bootstrap
  • docker containers static IP to communicate two different hosts
  • FROM openjdk:alpine
    COPY . /usr/src/testapp/
    WORKDIR /usr/src/testapp/
    CMD TestAppStart

    Image builds fine but when running it uwing following command it says:-
    /bin/sh: /usr/src/testmq/TestAppStart
    I also tried absolute path in CMD but same error.

    I have verified that the files are getting copied by changing CMD to /bin/sh the container starts and I get a shell inside it and I can navigate to that directory and see all the files and can even run the TestAppStart from there manually.

    Need help!

  • docker run command output
  • How to sync dir from a container to a dir from the host?
  • Docker rancher/agent won't start
  • Cadvisor support ELK stack
  • Setting up rabbitMQ on docker with python
  • Reference Zeppelin to Spark Master (in Docker Container)
  • One Solution collect form web for “docker run complains file not found”

    The /usr/src/testapp/ directory is not in the PATH environment variable, so /bin/sh complains.

    Change the last line to:

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