T
T
Talik2017-10-12 12:36:58
Docker
Talik, 2017-10-12 12:36:58

How to modify a file in a Docker container mounted from the host?

Background.
There is a container in which the database instance is deployed. To work correctly, you need to mount a number of volumes.
1. own folder with dumps and files
2. Some scripts that update the code in the database.
3. scripts for rolling updates in the container
Item 2 is entirely stored in SVN. Accordingly, before starting the container, it is updated through TeamCity.
Scripts have permissions that are committed by the developer. and some files do not have access rights for other users (because the container has its own user).
To roll changes for a specific environment, you need to replace the default file with a preconfigured one.
When you try to replace it with a preconfigured one, an error occurs due to the lack of rights to overwrite ...
How to properly mount a volume to avoid such situevins?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rustler2000, 2017-10-12
@Talik0507

```
$ mkdir aaa
$ echo aaa>aaa/a
$ echo bbb>aaa/b
$ echo ccc>aaa/c
$ echo ddd>d
$ docker run -it --rm -v $(pwd)/aaa:/ aaa -v $(pwd)/d:/aaa/b ubuntu cat /aaa/b
ddd
```

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question