kunal verma
kunal verma

Reputation: 486

Mount Current Directory in Containrer using docker file

I am new to docker i want to mount current directory in container and run command.

USING DOCKER FILE

mount current directory in a folder eg files

EG:

FROM ubuntu  As tuttt
VOLUME [ %cd% ]
ENTRYPOINT ["/bin/bash"]
RUN ls

Upvotes: 0

Views: 5088

Answers (1)

Mihai
Mihai

Reputation: 10757

Volumes are mounted when you run a container. Dockerfile is the definition of the steps to build an image. From the image you run a container.

You can build your image (remove the VOLUME declaration since it is not useful in your case) and then you run it with:

docker run -v <host_path>:<container_path> <image_tag>

Upvotes: 2

Related Questions