0

I am stuck on a weird problem with docker. I am copying over a local directory to an image. If I make a change to a file in the local directory, it's not being picked up in a new build. I deleted everything via docker system prune -a and rebuild which recreates the conda env, but ended up not taking the file changes. Could it be that the dest parent directory .config is hidden, so it's somehow not being deleted? relevant layers:

ADD ../.config/MyConfig /home/myself/.config/MyConfig
WORKDIR /home/myself/.config/MyConfig
CMD ["cat", "config.json"]

returns

{
  "domain_to_info": {
                "hello": {
                        "username": "myself",
                        "password": { "$ref" : ".password.json#/password" }
                }
        }
}

however in my config.json file locally I've changed it to password.json#password without the hidden .

A1122
  • 1,324
  • 3
  • 15
  • 35
  • How are you launching the container? How do you verify that the content is or isn't changed? – David Maze Jun 17 '21 at 14:05
  • `docker run user:my-project` – A1122 Jun 17 '21 at 14:12
  • Is that literally what you have in the Dockerfile; `ADD ../.config/...`? You can't reference files outside the directory tree you name in the `docker build` command (though you should get an error when the file is inaccessible). – David Maze Jun 17 '21 at 14:14
  • I was under the impression that the `docker build` command builds in the directory you specified, and to move to another directory outside of it has to be through relative path. If you're saying I can't do this, then I am more confused why this file is copied over successfully. – A1122 Jun 17 '21 at 14:17
  • 1
    [How to include files outside of Docker's build context?](https://stackoverflow.com/questions/27068596/how-to-include-files-outside-of-dockers-build-context) describes this further. – David Maze Jun 17 '21 at 14:18
  • this is useful, thanks – A1122 Jun 17 '21 at 14:30

0 Answers0