2017-10-01 1 views
-2

Ich habe nicht herausgefunden, wie man das Volume des Docker-Images in config.yml für die Integration mit CircleCI einbinden kann.Wie wird das Volume für den Docker-Container in der CircleCI-Konfiguration angegeben?

Offizielles Dokument gibt diese Variablen für container usage, Einstiegspunkt, Befehl, etc., aber keine über Volumenmontage.

Das Szenario ist, das Gebäude meines Projekts benötigt zwei Docker Container, der Hauptcontainer und der andere Container für Service-Foo. Um den Dienst foo zu verwenden, muss ich einige Artefakte, die in früheren Schritten generiert wurden, dem Container aussetzen und die nächsten Schritte ausführen.

Jeder hat eine Idee, ob ich das tun kann?

Antwort

0

Wie aus CircleCI genommen documentation:

Mounting Folders 
It’s not possible to mount a folder from your job space into a container in Remote Docker (and vice versa). But you can use docker cp command to transfer files between these two environments. For example, you want to start a container in Remote Docker and you want to use a config file from your source code for that: 

- run: | 
    # creating dummy container which will hold a volume with config 
    docker create -v /cfg --name configs alpine:3.4 /bin/true 
    # copying config file into this volume 
    docker cp path/in/your/source/code/app_config.yml configs:/cfg 
    # starting application container using this volume 
    docker run --volumes-from configs app-image:1.2.3 
In the same way, if your application produces some artifacts that need to be stored, you can copy them from Remote Docker: 

- run: | 
    # starting container with our application 
    # make sure you're not using `--rm` option otherwise container will be killed after finish 
    docker run --name app app-image:1.2.3 

- run: | 
    # once application container finishes we can copy artifacts directly from it 
    docker cp app:/output /path/in/your/job/space 
Verwandte Themen