skip to Main Content

I want to rename a conf.dev.json file to conf.json within the image during docker run time. How is this accomplished?

I don’t want to rename the file during image build because I don’t want to build env specific images and mounting a volume wont really work because I’m serving the file from within nginx server running in the container which is serving the site from the container image’s /html directory.

2

Answers


  1. Chosen as BEST ANSWER

    ok it looks like with nginx there is a magic folder that contains scripts to execute when the images starts.

    https://stackoverflow.com/a/70575191/491436

    I'm going to try this but if there is a more elegant way to approach this please do let me know.

    Thanks!


  2. If the file config.dev.json is located in /local on your host and the target file inside the container should be located in /tmp/config.json, then

    docker run -v /local/config.dev.json:/tmp/config.json -it -p 8080:8080 yourimage
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search