Does Concourse support "docker run -v option" to mount a volume


#1

I am looking for solution that mount a volume in host to a concourse docker process.

my use case is that after a concourse docker start, it runs some tests, the test result is saved to a file “/tmp/test.log” inside the docker, then the docker dies. But how can I transfer/map the /tmp/test.log to the host?


#2

I am a total Concourse newbie… but I think you should look at tasks outputs.


#3

@gotcha thanks for your reply.

The output files in the tutorial example are still inside the docker container. Both in task1 and task2. Currently the only thing I can think about is to a scp to cope the files from docker to external world. I am looking for if concourse itself support this (e.g -v option)


#4

AFAIU, if you use outputs together with resources, you can extract files produced.


#5

@gotcha is correct. In Concourse there is no way to transfer files to the host. One of the core design principles of Concourse is that tasks run in containers without leaving behind state.

In order to pass artefacts between steps in a job you can use task inputs/outputs. When you get resources at the start of a job this makes them available effectively like volume mounts on all subsequent puts and in tasks which define that resources as an input. When a task defines an output then this directory is subsequently mounted on every put/task with that named input.

In order to pass artefacts between jobs you will need to put to a resource in the first job then get from that resource in the subsequent job. Doing an scp from a task to transfer to the outside world would be considered an antipattern since it could result in two runs of a job with the same inputs yielding different results.

As a side note, Concourse doesn’t actually use Docker to start containers. Instead it uses Garden.


#6

@gotcha @crsimmons okey. thanks for your answer. When we say “resource”, does it only refer a git repo? because I am going to save the testing logs, it feel weird to save logs into a repo.


#7

In Concourse a resource can refer to one of the types included with Concourse, community resources, or custom ones you make yourself.

A pattern I see a lot for storing logs is to use the s3 resource to put them in a bucket.