Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 926 Bytes

README.md

File metadata and controls

22 lines (18 loc) · 926 Bytes

Ehh.. What is that?

This is a simple c++ program that will output some text file to the folder ./artifacts from a docker container. The motivation is to demonstrate a simple solution to persistant data when developping using Docker.

Usage

First, build an image from the Dockerfile in the current directory and tag the image. Note that the Dockerfile does not copy the source code, therefore you do not need to rebuild the image every time there's a change to the source code!

$ git clone https://github.com/piotte13/cpp_docker_persistance_example.git
$ cd cpp_docker_persistance_example

$ docker build -t docker_persistance_example .

Then, every time you want to run the program, run this command. The source code will be mounted to the docker container and the output files will directly be sent to the host system.

docker run --rm -it -v $(pwd):/project docker_persistance_example