9

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"]

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.

5
  • 4
    It's strongly preferable that you copy-and-paste error messages into your post, rather than re-typing them. Otherwise it makes it hard to be confident that we're looking at the real problem. Aug 24, 2016 at 9:35
  • @OliverCharlesworth i put a screenshot for the output i hope this will help
    – Amine
    Aug 24, 2016 at 9:51
  • Can you show ls -al /usr/local/tomcat/webapps/ ?
    – AstraSerg
    Aug 24, 2016 at 10:20
  • @AstraSerg the thing is that the container crash because of this error so i can not attache the container to run commands
    – Amine
    Aug 24, 2016 at 10:24
  • @Amine just add this command in the app.sh
    – AstraSerg
    Aug 24, 2016 at 10:45

3 Answers 3

19

In your Dockerfile: ADD fileA fileB. That will rename fileA to fileB at the moment of image creation.

10

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
-3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.