How to COPY files of current directory to folder in Dockerfile

I’m trying to create a Dockerfile that copies all the files in the currently directory to a specific folder.

Currently I have

  • I started a docker container with --rm Is there an easy way to keep it, without redoing everything?
  • docker container not finding the unix socket
  • access mysql with kubernetes : access denied for user root
  • Kubernetes Jenkins plugin - slaves always offline
  • php-fpm Connection reset by peer
  • Does hub.docker.com use “--no-cache” for automated builds?
  • COPY . /this/folder
    

    I’m unable to check the results of this command, as my container closes nearly immediately after I run it. Is there a better way to test if the command is working?

  • Database with starttime and endtime [closed]
  • How do I connect to a docker container running on a different host on a mac?
  • container running but cannot be visited in browser
  • How to Enable Systemd service in openshift/jenkins-1-centos7 docker container?
  • How does Istio compare to Traefik?
  • Docker: How Do I remove all images used to build a container?
  • 2 Solutions collect form web for “How to COPY files of current directory to folder in Dockerfile”

    you can start a container and check.

    $ docker run -ti --rm <DOCKER_IMAGE> sh
    $ ls -l /this/folder
    

    If your docker image has ENTRYPOINT setting, then run below command:

    $ docker run -ti --rm --entrypoint sh <DOCKER_IMAGE>
    $ ls -l /this/folder
    

    If it is only for testing, include the below command in your docker file:

    RUN cd /this/folder && ls
    

    This will list the directory contents while docker build

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