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 do you manage per-environment data in Docker-based microservices?
  • Route web Node.js + Vagrant + Nginx
  • Docker Automated build downloading private jars from a Maven Sonatype Nexus repository
  • Is it possible to start multiple docker daemons on the same machine
  • How to write data to host file system from Docker container
  • Re-mount volume in a running container
  • 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!

  • How can I check when was a docker image pulled?
  • Wildfly/Jboss-v10 is not working in cluster mode with docker swarm
  • Accessing a SQL Server from a .Net app running inside a Docker container
  • Pull docker images from private registry on remote host?
  • How to run docker-compose against docker swarm (without docker-machine)
  • Docker removes downloaded files
  • 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.