Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 581
Amine Avatar asked Aug 24 '16 09:08

Amine


People also ask

How do I rename a file in docker?

You can rename your docker image by docker tag command. Use the below given command to do that. To rename docker container, use the rename sub-command as shown, in the following example, we renaming the container discourse_app to a new name disc_app.

How do I rename a file in a container?

Create a new container field, enter into it and perform the Records->Replace Field Contents menu command with the following calculation: Replace ( GetValue ( Table::ExternalOpenContainer ; 2 ) ; 1 ; 5 ; "file:" & Get ( FileName ) & "/" )

Can I edit files in docker container?

Unfortunately, this also means Docker containers don't have a file editor like Vim or Nano preinstalled. In this guide, we'll show you how to install an editor, make the changes you need to, and return the container to its original state, both from the command line and using the Docker extension inside VS Code.

Can you rename a container in docker?

The docker rename command renames a container. For example uses of this command, refer to the examples section below.


1 Answers

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

like image 144
Vadym Tyemirov Avatar answered Sep 21 '22 14:09

Vadym Tyemirov