Rename file in docker container

I’m having a weird Error when i try to run a simple script on docker container on redhat machine, this is the Docker file

From tomcat:7.0.70-jre7
ENV CLIENTNAME geocontact
ADD tomcat-users.xml /usr/local/tomcat/conf/
ADD app.war /usr/local/tomcat/webapps/
COPY app.sh /

ENTRYPOINT [“/app.sh”]

  • docker daemon crashes randomly after add ENTRYPOINT - Docker
  • Port Publishing When Running with Docker Compose
  • Inheriting from postgres docker container - doesn't keep the daemon alive?
  • gem: command not found
  • Using git clone in a Dockerfile Produces empty working directory
  • Docker, running Macos docker image on Windows
  • and app.sh is the script that cause the problem “only on redhat”

    #!/bin/bash
    set -e
    mv /usr/local/tomcat/webapps/app.war /usr/local/tomcat/webapps/client1.war
    catalina.sh run
    

    and the error message :

    mv cannot move ‘/usr/local/tomcat/webapps/app.war to a subdirectory of itself, ‘/usr/local/tomcat/webapps/client1.war’

    a screenshot for the error
    and this only on redhat, i run the same image on ubuntu and centos with no problems.

  • View NodeJS Application Logs Via Cron Tasks on Supervisor on Docker
  • What's the fastest way to migrate from boot2docker to Vagrant+NFS on Mac OS X?
  • Production ready LAMP stack - in Docket, Rocket etc
  • Scaling microservices using Docker
  • Understanding how to import a map.osm file into a postgres database.
  • Docker: Cronjob is not working
  • 2 Solutions collect form web for “Rename file in docker container”

    You can split your command in 2 commands :

    cp /usr/local/tomcat/webapps/app.war /usr/local/tomcat/webapps/client1.war
    rm /usr/local/tomcat/webapps/app.war
    

    you can edit file inside container and commit changes without buiding image.

    docker commit existing_containername commited_image_name

    then run container with new for example

    docker run –name tomcat -td commited_image_name

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