I use docker-compose for deployment with installation 2 docker-compose.yml, where I create the image locally and pull it from the dock on the server.
In addition to building and pulling the image, the configuration of the volumes is the same.
Locally:
app:
build: .
volumes:
- "/data/volume:/volume"
And on the server:
app:
image: username/repo:tag
volumes:
- "/data/volume:/volume"
In my Docker file:
volume /volume
Locally, my volume is mounted in the specified directory, files created by the application are saved there outside the container. However, this does not happen on the deployment server.
Files but they are created and saved during deployment, although my deployment script works docker-compose down -v, which supposedly deletes named and anonymous volumes in the container.
, - , , . ? .
:
. :
docker-compose down -v --rmi all --remove-orphans
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker volume rm $(docker volume ls -q)
... , , , :
docker pull username/repo:tag
docker-compose build --no-cache --force-rm
docker-compose up -d
... , , , , , . ?
docker inspect <container> :
"Mounts": [
"Source": "/data/volume",
"Destination": "/volume",
"Mode": "rw",
"RW": true,
"Propagation": "rprivate"
]
, "rprivate", .