Amine Amine - 1 year ago 258
Linux Question

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
ADD tomcat-users.xml /usr/local/tomcat/conf/
ADD app.war /usr/local/tomcat/webapps/


and is the script that cause the problem "only on redhat"

set -e
mv /usr/local/tomcat/webapps/app.war /usr/local/tomcat/webapps/client1.war 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.

Answer Source

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download