I have this docker-compose:
version: "3.9"
services:
myserver:
image: <some image>
restart: always
volumes:
- ./res:/tmp/configs
- ./myfolder:/tmp/logs
Should I expect to see the files that are in /tmp/logs inside the container, in the host folder 'myfolder'? 'myfolder' is empty and I want it to be updated with the contents of the /tmp/logs folder in the container.
CodePudding user response:
For formatting purposes, I post this as an answer instead of comment.
Can you put following in test.sh
on the host?
#!/usr/bin/env bash
testdir=/tmp/docker-compose
rm -rf "$testdir"; mkdir -p "$testdir"/{myfolder,res}
cd "$testdir"
cat << EOF > docker-compose.yml
version: "3.9"
services:
myserver:
image: debian
restart: always
volumes:
- ./res:/tmp/configs
- ./myfolder:/tmp/logs
command: sleep inf
EOF
docker-compose up
and run bash test.sh
on the host and see if it works. host dir is /tmp/docker-compose/myfolder
.
CodePudding user response:
What worked for me is using full path for the host path.
C:\myfolder
for example.