Why docker container can access my directory without -v flag?

Viewed 32

I was updating Docker and then it showed me a tutorial. Interested, I decided to see whether there are something new. It worried me.

The command:

$ docker run --name repo alpine/git clone https://github.com/docker/getting-started.git
$ cd getting-started
$ docker build -t docker101tutorial .

The problem is that, alpine/git image can write to the host directory, even without the -v flag.

As I was writing this SO, I checked the alpine/git image's Dockerfile.

The alpine/git image's Dockerfile contains VOLUME [/git] and WORKDIR /git. I expected that it will be stored in host directory /getting-started and not ~/getting-started.

0 Answers
Related