I just want to rename a few files, without overriding the commands inside the wordpress image that the docker is pulling in. Inside the docker-compose.yml I tried using 'command' and 'entrypoint' to run bash commands, both basically interrupt what's happening inside the image and it all fails.
1
you have three main ways to run a command after the container starts:
docker exec -d someContainer some command
from the command line,CMD ["some", "command"]
from your Dockerfilecommand: some command
from a docker-compose fileif none of these is working for you, probably, you are doing something wrong. A common mistake is using multiple
command
in your docker-compose file, like so:this doesn't work, because the last command overrides the commands above, what you should do is concatenate the commands:
take a look at this question.
edit: one thing i forgot to include is that the same behavior above is true to CMD in your Dockerfile, you can't do this:
instead, you should concatenate the commands, just like the docker-compose:
but this is very boring if you have a lot of commands, so an alternative is to use a shell script with all the commands you need and execute it in your Dockerfile:
see this question
As you haven't provided any code it's hard to say, but also, maybe you can use
RUN command to rename
as the last command(just before the CMD if you are using it) in your Dockerfile to rename these files at build time(what IMHO makes more sense because this is kind of thing you should do when you are building your images). So if you want more help, please, include your code too.