Docker Community Forums

Share and learn in the Docker community.

Files not visible on host

Hey,

I am trying to understand how the volumes work in Docker.
I read the docs but I want to see it working to understand it completely.
I have created a container which creates a *.txt-file that I want to see on my host drive.
The directory gets created but I do not see the test.txt file.
It IS created inside the container because I can find it inside the container.
Can anyone tell me what I am doing wrong please?

Dockerfile:
FROM alpine
RUN mkdir -p /app/ && echo ‘test’ > /app/test.txt

Docker-compose:
version: “3”
services:
test-container:
build:
context: .
container_name: testfile
image: testfile
volumes:
- ~/mount/:/app